罗贤泽 @ 2019-01-28 15:51:07
样例过了,为什么0分啊?
#include<bits/stdc++.h>
using namespace std;
bool Map[205][205];
int num[205];
int cnt = 1;
int tmp = 1;
int main()
{
int n;
cin>>n;
while(cin>>num[cnt++]);
bool button = false;
cnt = 1;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
Map[i][j] = button;
if(tmp>=num[cnt])
{
cnt++;
button = !button;
tmp = 0;
}
tmp++;
}
}
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
cout<<Map[i][j]<<" ";
cout<<endl;
}
return 0;
}
by Sya_Resory @ 2019-01-28 15:56:09
@罗贤泽 你先直接构造出一个超长字符串,输出时再处理换行试试
by In_blue @ 2019-05-17 12:21:41
using namespace std; int a[210]; int n; int main() { cin>>n; int t=0; int s; int p=0; while(p<nn) { t++; cin>>a[t]; p+=a[t]; } for(int i=1;i<=2n;i++) { if(i%2==1) { for(int j=1;j<=a[i];j++) { if((t+j)%7==0)t-=7,cout<<"0"<<endl; else cout<<"0"; } } else { for(int j=1;j<=a[i];j++) { if((t+j)%7==0)t-=7,cout<<"1"<<endl; else cout<<"1"; } } t+=a[i]; } return 0; } //求助大佬,为什么为零分?