1 solutions
-
0
#include<iostream> #include<string> using namespace std; int n; int main() { cin>>n; char a[1003][1003]; string b; cin.get();//读取回车; getline(cin,b);//读取带空格的字符串 int lenth = b.length(); int hang = lenth/n; if(lenth%n)hang++; int p = 0; for(int j = hang-1;j>=0;j--) { for(int i = 0;i < n;i++){ if(b[p])a[i][j] = b[p]; else a[i][j] = ' '; p++; } } for(int i = 0;i < n;i++) { for(int j = 0;j < hang;j++) { cout<<a[i][j]; } puts(""); } return 0; }
Information
- ID
- 211
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 9
- Tags
- # Submissions
- 44
- Accepted
- 5
- Uploaded By