|
|
back to boardDiscussion of Problem 1068. Sum1068 Posted by lestat 22 May 2004 00:48 I've sold it with the long solution, but I found a shorter one and I can't understand why it is not accepted. var n,tmp:longint; begin readln(n); if n>0 then write((((n+1)*n)/2)) else write(-(((-n+1)*-n)/2)+1); end. How many times did you ran it? You must write: write((((n+1)*n)/2):0:0) or use div 2 or shr 1 instead /2 |
|
|