4 条题解
-
1
疯狂if语句 太
简单了话不多说,上代码!#include<iostream> using namespace std; int main() { int n; cin>>n; if(n == 1) { cout<<"A"; } if(n == 2) { cout<<"A"<<endl; cout<<"AB"<<endl; } if(n == 3) { cout<<"A"<<endl; cout<<"AB"<<endl; cout<<"ABC"<<endl; } if(n == 4) { cout<<"A"<<endl; cout<<"AB"<<endl; cout<<"ABC"<<endl; cout<<"ABCD"<<endl; } if(n == 5) { cout<<"A"<<endl; cout<<"AB"<<endl; cout<<"ABC"<<endl; cout<<"ABCD"<<endl; cout<<"ABCDE"<<endl; } if(n == 6) { cout<<"A"<<endl; cout<<"AB"<<endl; cout<<"ABC"<<endl; cout<<"ABCD"<<endl; cout<<"ABCDE"<<endl; cout<<"ABCDEF"<<endl; } if(n == 7) { cout<<"A"<<endl; cout<<"AB"<<endl; cout<<"ABC"<<endl; cout<<"ABCD"<<endl; cout<<"ABCDE"<<endl; cout<<"ABCDEF"<<endl; cout<<"ABCDEFG"<<endl; } if(n == 8) { cout<<"A"<<endl; cout<<"AB"<<endl; cout<<"ABC"<<endl; cout<<"ABCD"<<endl; cout<<"ABCDE"<<endl; cout<<"ABCDEF"<<endl; cout<<"ABCDEFG"<<endl; cout<<"ABCDEFGH"<<endl; } if(n == 9) { cout<<"A"<<endl; cout<<"AB"<<endl; cout<<"ABC"<<endl; cout<<"ABCD"<<endl; cout<<"ABCDE"<<endl; cout<<"ABCDEF"<<endl; cout<<"ABCDEFG"<<endl; cout<<"ABCDEFGH"<<endl; cout<<"ABCDEFGHI"<<endl; } return 0; }
-
0
#include <cstdio> using namespace std; int main(){ int n; scanf("%d",&n); for(int i=1;i<=n;i++){ for(int j=0;j<i;j++)printf("%c",j+'A'); printf("\n"); } return 0; }
其实就是我在【入门】字母直角2中发布的题解中第7行的i改成j
- 1
信息
- ID
- 973
- 时间
- 1000ms
- 内存
- 64MiB
- 难度
- 1
- 标签
- 递交数
- 72
- 已通过
- 56
- 上传者