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

WA 1 Что не так?
Posted by Sergo 22 Aug 2018 23:52
var

  i, n: integer;
  c : real;

begin
  read(n);
  c := 0;
  if n > 0 then
  begin
    for i := 1 to n do
      c := n;
    write(c);
  end;
  if n <= 0 then
  begin
    for i := 1 downto n + 1  do
      c := (-((-n) * (1 - n) / 2) + 1);
    write(c);
  end;
end.
Re: WA 1 Что не так?
Posted by SpamBot 16 Jan 2019 22:17

Доп. примеры/add. examples:
n=-5
-5+(-4)+(-3)+(-2)+(-1)+0+1

n=5
5+4+3+2+1

n=0
0+1

Арифмет. прогрессия/arithm. progression