| ||||||||||
| 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 | |||||||||
Re:求教 SCANF(%S) GETSIn Reply To:求教 SCANF(%S) GETS Posted by:gamegame151 at 2010-09-17 13:56:00 > for (k=1;k<=n;k++)
> {
> printf("Game %d:\n\n",k);
> for (i=1;i<=10;i++)
> {
> scanf("%s", ss);//把这里由get(ss)变为scanf然后就AC了
> //fgets(ss,100,in);
> //printf("%s",ss);
> for (j=0;j<15;j++)
> {
> if (ss[j] =='R') c[11-i][j+1] = 1;
> if (ss[j] =='G') c[11-i][j+1] = 2;
> if (ss[j] =='B') c[11-i][j+1] = 3;
> //printf("%d",c[i][j]);
> }
> }
> 在上面的输入代码中,scanf("%s")就AC,gets()就WA,什么原因呢?
当然,每组case之间有空行。。。用scanf就把空行忽略了,gets就读进去了,然后就悲剧了。。。
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator