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

Lovi rechenie
Posted by Гг 16 Oct 2008 16:15
var N,S: integer;
begin
readln(N);
if N<=1 then
begin
while n<=1 do
begin
s:=n+s;
n:=n+1;
end;
end
else
begin
while n>=1 do
begin
s:=s+n;
n:=n-1;
end;
end;
writeln(S);
end.
 Pascal
Zaranie po>I<@luicta
Re: Lovi rechenie
Posted by Pavel Otchertsov 7 Nov 2008 23:31
You can solve it with more faster algorithm.
Just use the sum of arithmetic progression =)