getchar on codeforces

Правка en2, от heyyolol, 2019-07-31 16:18:02

Recently I tried using getchar to take in char input (c++), the sample works fine on my compiler , but got idleness limit exceeded on judge, I tried the code in custom invocation, and it turns out getchar was reading random characters lol. My code is something like

for(int i=0;i<n;++i) for(int j=0;j<n;++j) while(grid[i][j]!='.'&&grid[i][j]!='#') grid[i][j]=getchar()

Does anyone know how to fix this problem? Thank you!! :)

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский heyyolol 2019-07-31 16:18:02 14
en1 Английский heyyolol 2019-07-31 16:17:07 465 Initial revision (published)