|
|
вернуться в форумi used cin instead of scanf, and get ac Послано yrz 10 янв 2015 05:36 why it happened!!?? because of this, i debug for a long time but no effect. Re: i used cin instead of scanf, and get ac void Read() { int i,j;char In[NUM]; scanf("%d%d",&n,&m); for(i=0;i<=n+1;i++) for(j=0;j<=m+1;j++)Map[i][j]=1; for(i=1;i<=n;i++) { scanf("%s",In); for(j=1;j<=m;j++) { Map[i][j]=(In[j-1]=='*'); if(!Map[i][j]){tx=i;ty=j;} } } } this Read() got AC I think it's probably because you ignored the '\n' at the end of the line try this change: void Read() { int i,j;char ch; scanf("%d%d",&n,&m); for(i=0;i<=n+1;i++) for(j=0;j<=m+1;j++)Map[i][j]=1; for(i=1;i<=n;i++) { scanf("%c",&ch); for(j=1;j<=m;j++) { scanf("%c",&ch); Map[i][j]=(ch=='*'); if(!Map[i][j]){tx=i;ty=j;} } } } I tested and both can AC this problem. |
|
|