| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
此题的输入有问题,不光是要处理多余的空格,如果读到换行才结束要TLE,or(int j=0;j<2;j++)
{
scanf("%d",&n);
char c=getchar();
while(c!='\n') c=getchar();
cnt=1; tmp=0;
for(int i=1;i<=n;i++)
{
cnt+=tmp;
tmp=0;
while((c=getchar())!=-1)
{
// while(1)
//{
// c=getchar(); 这样的话TLE了
if(c>='0'&&c<='9')
{
int sum=0;
do
{
sum*=10;
sum+=c-'0';
c=getchar();
}while(c>='0'&&c<='9');
r[sum][j]=cnt;
tmp++;
f[sum]=1;
}
if(c=='\n') break;
}
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator