|
|
back to boardDiscussion of Problem 1068. Sumwa #2 what's wrong in my code: #include <stdio.h> main() { int a; scanf("%d",&a); if( a >= 0 ) printf("%d",a*(a+1)/2); else { a = -a; printf("-%d",a*(a+1)/2-1); } return 0; } Edited by author 25.08.2012 15:05 Edited by author 25.08.2012 15:06 Re: wa #2 Posted by Ilian 18 Aug 2013 19:03 If a is 0,the answer IS 1, not 0. |
|
|