Difference between typecasting and using of 1ll in multilication??

Правка en1, от iamstg, 2016-07-15 14:11:15

I was submitting the solution for Round #362 Div2 Problem E :

http://codeforces.me/contest/697/problem/E

I got WA on Test#4 on this submission : http://codeforces.me/contest/697/submission/19150824 I had typecasted every possible places where I felt overflow could occur with long long. I submitted many times but it gave wrong answer with typecast.

Then I submitted using 1ll in multiplication instead of typecast in this submission and it got accepted: http://codeforces.me/contest/697/submission/19150943

My question is why does typecasting not work and what is the difference between typecasting and 1ll?? Also when to use which because many of the solutions I coded before used typecasts and it worked well on various judges including Codeforces until I encountered this case for the first time.

Теги gnu c++11

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский iamstg 2016-07-15 14:11:48 1
en1 Английский iamstg 2016-07-15 14:11:15 885 Initial revision (published)