模仿古人写字
2024-07-20 10:05:42
发布于:浙江
19阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int n,h,p=0;
string a,b[501][501];
int main(){
cin>>n;
getchar();
getline(cin,a);
int l=a.size();
if(l%n==0) h=l/n;
else h=l/n+1;
for(int i=h;i>0;i--){
for(int j=1;j<=n;j++){
if(p<l) b[j][i]=a[p++];
else b[j][i]=' ';
}
}
for(int i=1;i<=n;i++){
for(int k=1;k<=h;k++) cout<<b[i][k];
if(i<n) cout<<endl;
}
return 0;
}
(https://attach.acgo.cn/picture/fa48715e01e04f9083ebb3d1fdb887fe.jpg)
aaaa
这里空空如也
有帮助,赞一个