什么diao题,#1多一个换行符?

P2704 [NOI2001] 炮兵阵地

chichow @ 2021-05-17 21:58:16

字符串和换行符本就是让人头疼的题,此题为何样例#1和其他不一样啊!(“▔□▔)

错的我莫名其妙

  for (int i=1; i<=N; i++){
    for (int j=1; j<=M; j++){
      while(1){
        c=getchar();
        if (c=='H'||c=='P') break;
      }
      ma[i] = (ma[i]<<1)+(c=='H');
    }
  }

by cxh315 @ 2021-05-17 22:09:28

艹我当初也是


by cxh315 @ 2021-05-17 22:09:55

https://www.luogu.com.cn/paste/rvbihtp5


by KellyFrog @ 2021-05-17 22:37:56

@chichow 直接用scanf不就好了吗 qwq


by chichow @ 2021-05-18 00:02:41

@longer_name scanf不自己处理换行符?难道还有什么新姿势?(´⊙ω⊙`)!


|