ffbhf @ 2024-11-19 10:39:58
int main() { int n; scanf("%d", &n); int t; long long j; long long i =1; while (i<=n*n) {
scanf("%d", &t);
j = i;
for (i; i <j+t; i++)
{
printf("0");
if (i % n==0)
{
printf("\n");
}
}
j = i;
scanf("%d", &t);
for (i; i <j+t; i++)
{
printf("1");
if (i%n==0)
{
printf("\n");
}
}
j = i;
}
system("pause");
return 0;
}
#include<stdio.h>
int main()
{
int n;
scanf("%d", &n);
int t;
long long j;
long long i =1;
while (i<=n*n)
{
scanf("%d", &t);
j = i;
for (i; i <j+t; i++)
{
printf("0");
if (i % n==0)
{
printf("\n");
}
}
j = i;
scanf("%d", &t);
for (i; i <j+t; i++)
{
printf("1");
if (i%n==0)
{
printf("\n");
}
}
j = i;
}
system("pause");
return 0;
}
by CHkujiu @ 2024-12-29 18:25:37
@ffbhf
你这代码——怎么断断续续的?
by CHkujiu @ 2024-12-29 18:26:17
求关
#include<bits/stdc++.h>
using namespace std;
const int N=10010;
int n;
int ccc;
bool ch;
vector<int> a;
int main()
{
int x;
cin>>n;
while(cin>>x)
a.push_back(x);
for(int i=0;i<a.size();i++)
{
ch=ch?false:true;
int k=a[i];
for(int j=0;j<k;j++)
{
cout<<(ch?"0":"1");
if(ccc==n-1)puts("");
ccc=(ccc+1)%n;
}
}
return 0;
}