|
|
back to boardDiscussion of Problem 1068. SumI got AC with an 28K program!! Posted by Drizzt 15 Mar 2003 08:09 program Sum (input, output); var lI, lN : longint; begin readln (lN); if lN > 0 then lI := (lN + 1) * lN div 2; if lN = 0 then lI := 1; if lN < 0 then lI := (abs (lN) + 1) * lN div 2 + 1; writeln (lI); end. |
|
|