ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1519. Formula 1

i used cin instead of scanf, and get ac
Posted by yrz 10 Jan 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
Posted by liuyunhui123 3 Feb 2016 09:21
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.