用gets()为啥会CE啊= = 代码如下:
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<map>
#include<stdio.h>
#define ll long long
using namespace std;
ll n,val[1001][1001],num=0;
bool op=1;
inline ll read()
{
char c;
long long f=1,num=0;
c=getchar();
while(c<'0'||c>'9')
{
if(c=='-')
f=-1;
c=getchar();
}
while(c>='0'&&c<='9')
{
num=num*10+c-'0';
c=getchar();
}
return num*f;
}
int main()
{
n=read();
for(int i=1;i<=n;i++)
{
map<char,int>m;
ll line;
cin>>line;
char judg[10001];
****gets(judg);****//这行本地显示没问题luogu却报错了
for(int j=0;j<strlen(judg);j++)
{
if(judg[j]=='n')
{
num=judg[j+2]-'0';
break;
}
}
if(num<0)
num=0;
ll situ=0,maxn=0;
for(int j=1;j<=line;j++)
{
char s[10001]="\0";
gets(s);
if(s[0]=='F')
{
##### ll placepre=0,placepos=0,placen=0;
if(m.count(s[2])==1)
{
op=0;
break;
}
m[s[2]]=1;
for(int t=0;t<strlen(s);t++)
{
if(s[t]>='0'&&s[t]<='9'&&placepre==0)
placepre=t;
if(s[t]>='0'&&s[t]<='9'&&placepre!=0)
placepos=t;
if(s[t]=='n')
placen=t;
}
if(placen>0&&placepre>0&&placen>placepre)
situ++;
}
if(s[0]=='E')
{
maxn=max(maxn,situ);
situ--;
}
}
if(situ>0||!op)
{
cout<<"ERR"<<endl;
op=1;
}
else if(num==maxn)
{
cout<<"Yes"<<endl;
}
else
{
cout<<"No"<<endl;
}
}
return 0;
}