Then enter an Integer X (0<X<=10^5), said the figure’s the first X words.
wsdyd Output the words. 示例输入 A 2A 3B 3 示例wsdyd NcwcbcNcwcbcncbcwcbcNcwcbcncbcwcbcncbc 都马上大二了,做这个题,还想了想..... ruo! 一看就是规律题,但是只有A,B在开头时要单独考虑,其他情况在纸上一画便知#include<cstdio>#include<iostream>#include<cstring>#include<algorithm>using namespace std;string a[5]="wcnc",b[5]="ncbu";int main(){ ios::sync_with_stdio(false); int n,m,i; char c; ios::sync_with_stdio(false); while(cin>>c>>n) { if(c=='A') { if(n==1) { printf("Waysdn"); continue; } if(n==2) { printf("Ncwcbcn"); continue; } else { printf("Ncwcbc"); for(i=0;i<n-2;i++) { printf("ncbcwcbc"); } printf("n"); } } else { if(n==1) { printf("Ncn"); continue; } else { printf("Nc"); for(i=0;i<n-1;i++) printf("wcbcncbc"); printf("n"); } } } return 0;}