zuoyang001 @ 2023-11-04 13:24:07
#include<bits/stdc++.h>
using namespace std;
long long n,s,f=0,len=0;
int main(){
cin>>n;
while(cin.get()!='\n'){
cin>>s;
if(f==0){
for(int i=1;i<=s;i++){
if(len>=n){
cout<<endl;
len=0;
}
cout<<"0";
len++;
}
f=1;
}
else{
for(int i=1;i<=s;i++){
if(len>=n){
cout<<endl;
len=0;
}
cout<<"1";
len++;
}
f=0;
}
}
return 0;
}
by progress_from0 @ 2023-11-04 14:37:04
给你一组数据,可能是while那一句的问题
5 0 5 2 1 2 5 2 1 2 5
11111
00100
11111
00100
11111
by progress_from0 @ 2023-11-04 14:51:36
@zuoyang001
字符串的换行很玄学,不一定是\n(起码在这组数据失灵了),不如开一个
by zuoyang001 @ 2023-11-04 19:53:59
@progress_from0 这组数据我试了,答案是对的,样例我也过了,为什么都是TLE?
by progress_from0 @ 2023-11-05 17:13:34
@zuoyang001 输完样例的程序答案是对的,但是它还能继续输入,程序没有结束,所以会tle
by zuoyang001 @ 2023-11-05 17:52:08
@progress_from0 ok,我知道了,我按照你说的重做了一下,果然AC了,谢谢指导!
by progress_from0 @ 2023-11-08 06:43:28
不客气