EbraM96's blog

By EbraM96, history, 8 years ago, In English

A: I submitted my code to problem B and I was redirected to my submissions page there were no entries in the submissions page ! I had to refresh the page to see my submission !

Edit : also after refreshing the page again I saw the same submission which already had WA verdict re-running the pretests again and surely gave the same WA !

B: These two submissions (Problem B) :

21448936

21449637

the only difference is that in the first one I used :

while(scanf("%c" , &c)==1)

to get all the characters from the input and I got "Wrong answer on pretest 1"

in the second one I used the c++ cin to get the whole string first then process it :

cin>>s;

and I got "Pretests passed" costing me +7 minutes to get it accepted :(

why did this happen ????? thought scanf() works until it reaches end of file !

  • Vote: I like it
  • -36
  • Vote: I do not like it

| Write comment?
»
8 years ago, # |
  Vote: I like it +1 Vote: I do not like it

while(scanf(" %c" , &c)==1)

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Because scanf("%c", &c) will read a new line character '\n'.

  • »
    »
    8 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    but there is not empty line nor spaces in the input ?

    • »
      »
      »
      8 years ago, # ^ |
        Vote: I like it +12 Vote: I do not like it

      The input ends with a newline. This is true for almost all problems.