社区讨论
20分,求调
P1319压缩技术参与者 2已保存回复 2
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 2 条
- 当前快照
- 1 份
- 快照标识符
- @mlrqadlp
- 此快照首次捕获于
- 2026/02/18 15:46 20 小时前
- 此快照最后确认于
- 2026/02/19 12:12 4 分钟前
CPP
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, x, sum = 0, hang = 0, shu = 0;
cin >> n;
while (sum != n*n){
cin >> x;
if (x+hang >= n){
for (int i = 1; i <= n-hang; i++){
if (shu%2 != 0){
cout << 1;
}
else{
cout << 0;
}
}
hang = hang+x-n;
cout << endl;
for (int i = 1; i <= hang; i++){
if (shu%2 != 0){
cout << 1;
}
else{
cout << 0;
}
}
}
else{
for (int i = 1; i <= x; i++){
if (shu%2 != 0){
cout << 1;
}
else{
cout << 0;
}
}
hang += x;
}
shu++;
sum += x;
}
return 0;
}
回复
共 2 条回复,欢迎继续交流。
正在加载回复...