asdfghjl's blog

By asdfghjl, history, 7 years ago, In English

For my first solution I was expecting WA because of integer overflow (int sum) but I got TLE instead which is odd because my time complexity is O(n) and it should work for the maximum value of n(10^6)!! Then I just tried the same code with scanf/printf and got AC :| I also changed the type of sum to long long and used cin/cout like the first time and got AC! Can someone tell me WHYYYY?

link to my second solution

link to my third solution

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it