ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1068. Sum

DO U MIND TELLING ME WHAT'S WRONG WITH THIS?
Posted by Khosrow 25 Jun 2007 19:54
here is my program;
program khosrow;
var
n:longint;
begin
readln(n);
if n<0 then writeln((n*(1-n) div 2)+1)
else writeln((n*(n+1)) div 2);
end.
Re: DO U MIND TELLING ME WHAT'S WRONG WITH THIS?
Posted by AlexF [USTU] 25 Jun 2007 21:06
var
n:longint;
begin
readln(n);
if n<=0 then writeln((n*(1-n) div 2)+1)
else writeln((n*(n+1)) div 2);
end.

This is AC
Re: DO U MIND TELLING ME WHAT'S WRONG WITH THIS?
Posted by Khosrow 27 Jun 2007 22:39
thanks:D