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

I got AC with a program which has only 6 lines.
Posted by chenyuxi 11 May 2004 18:38
I don't believe!!
var n,i:longint;
begin
  readln(n);
  if n>=1 then writeln((n+1)*n div 2)
    else writeln((n+1)*(2-n) div 2);
end.
Oh, you are great programmer!
Posted by Vladimir Yakovlev (USU) 11 May 2004 20:04
Re: Oh, you are great programmer!
Posted by Victor S 11 May 2004 22:03
It is a sum of arifmetical progression!
Re: Oh, you are great programmer!
Posted by chenyuxi 12 May 2004 16:35
Thank you very much!!
Re: I got AC with a program which has only 6 lines.
Posted by Searchers 3 Nov 2004 16:44
U are verry-verry clever person!!!
Nothing special. Everybody can see that. And I can reduce the length of prog by 1 byte(+)
change n>=1 into n>0 :)
-_-
Posted by kcm1700 13 Jun 2005 17:16
so what,,, I did it in 3 lines.
Re: I got AC with a program which has only 6 lines.
Posted by Lunar 19 Jul 2006 06:41
I think one line is OK.
Re: I got AC with a program which has only 6 lines.
Posted by javran 14 Oct 2006 13:38
it is very good.