gtk_cy @ 2020-12-12 16:22:21
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int b[40100]={};
char s[21][21];
int main()
{
int i=1,n=0,k=1;
freopen("outttttt.txt","w",stdout);
gets(s[1]);
n=strlen(s[1]);
for(i=2;i<=strlen(s[1]);i++)
gets(s[i]);
cout<<n<<" ";
for(i=1;i<=n;i++)
{
for(int j=0;j<n;j++)
{
b[(i-1)*n+j+1]=int(s[i][j])-'0';
}
}
for(i=1;i<=n*n;i++)
{
if(b[i]==1)
{
cout<<0<<" ";
break;
}
}
for(i=2;i<=n*n;i++)
{
if(b[i]==b[i-1])k++;
else
{
cout<<k<<" ";
k=1;
}
}
cout<<k<<endl;
return 0;
}
测试点都对但都是WA,求助啊qaq
by hezhiyuan @ 2020-12-12 16:24:50
对了还是WA?
by gtk_cy @ 2020-12-12 16:27:14
是自己测试答案都对,但是评测系统WA
by _caiji_ @ 2020-12-12 16:30:53
去掉freopen和gets
by gtk_cy @ 2020-12-12 16:32:56
gets为什么要去掉?
by syx23771 @ 2020-12-12 16:44:07
,
by gtk_cy @ 2020-12-12 17:04:19
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int b[40100]={};
char s[201][201];
int main()
{
int i=1,n=0,k=1;
scanf("%s",&s[1]);
n=strlen(s[1]);
for(i=2;i<=n;i++)
scanf("%s",&s[i]);
cout<<n<<" ";
for(i=1;i<=n;i++)
{
for(int j=0;j<n;j++)
{
b[(i-1)*n+j+1]=int(s[i][j])-'0';
}
}
for(i=1;i<=n*n;i++)
{
if(b[i]==1)
{
cout<<0<<" ";
break;
}
}
for(i=2;i<=n*n;i++)
{
if(b[i]==b[i-1])k++;
else
{
cout<<k<<" ";
k=1;
}
}
cout<<k<<endl;
return 0;
}
改了,就这个,但是这个评测点还是过不去: in: 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000110000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000001100000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000110000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000011000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000110000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000001100000000000000000 0000000000000000000000000000000000001111 out: 40 305 2 200 2 138 2 248 2 440 2 200 2 53 4
by gtk_cy @ 2020-12-12 17:31:34
好的,我ac了
by Quit @ 2020-12-12 20:53:58
%%%