社区讨论
关于RE
学术版参与者 7已保存回复 27
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 27 条
- 当前快照
- 1 份
- 快照标识符
- @mlh9k6ze
- 此快照首次捕获于
- 2026/02/11 08:00 上周
- 此快照最后确认于
- 2026/02/12 16:40 7 天前
CPP
#include<bits/stdc++.h>
#define int long long
using namespace std;
string st[100005];
int n,cnt,len,m;
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
while(getline(cin,st[++n])) {
len=max(len,st[n].size()*1ll);
}
n--;
for(int i=1;i<=len+2;i++) cout<<"*";
cout<<endl;
for(int i=1;i<=n;i++) {
m=len-st[i].size();
if(m%2) {
cnt++;
if(cnt%2) {
cout<<"*";
for(int j=1;j<=m/2;j++) cout<<" ";
cout<<st[i];
for(int j=1;j<=m/2+1;j++) cout<<" ";
cout<<"*";
}
else {
cout<<"*";
for(int j=1;j<=m/2+1;j++) cout<<" ";
cout<<st[i];
for(int j=1;j<=m/2;j++) cout<<" ";
cout<<"*";
}
}
else {
cout<<"*";
for(int j=1;j<=m/2;j++) cout<<" ";
cout<<st[i];
for(int j=1;j<=m/2;j++) cout<<" ";
cout<<"*";
}
cout<<endl;
}
for(int i=1;i<=len+2;i++) cout<<"*";
return 0;
}
这代码在c++上可以正常运行,单位什么会在某网站上re?
回复
共 27 条回复,欢迎继续交流。
正在加载回复...