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

Что не так?
Posted by Kovalyshyn Artur 19 Oct 2016 15:36
program Suma;
var a,b,e:integer;
begin
read(a);
b:=1;
if a<0 then
e:=((1+a) div 2)*(((a-1)div((b-1)-1))+1)
else
e:=(a*(a+1)) div 2;
writeln(e);
end.
Re: Что не так?
Posted by Oleg Baskakov 19 Oct 2016 15:59
Check for N = 0.
Re: Что не так?
Posted by Kovalyshyn Artur 21 Oct 2016 16:37
import java.util.Scanner;

public class P
{
    public static void main(String[] args)
    {
        Scanner input = new Scanner(System.in);
        int a = input.nextInt();
        int b = 1;
        if (a>-10000)
            if (a < 10000)
            {
                if (a >= 1)
                {
                    int e = (a * (a + 1)) / 2;
                    System.out.println(e);
                }
                if (a <= -1)
                {
                    int d = ((1 + a) / 2) * ((a - 1) / ((b - 1) - 1) + 1);
                    System.out.println(d);
                }
                if (a<1)
                  if (a>-1)
                  {
                      System.out.print(a+1);
                  }
            }

    }
}



я уже всё зделал, что они просили. И всё равно не идёт(

Edited by author 21.10.2016 18:08

Edited by author 21.10.2016 18:37
Re: Что не так?
Posted by German 21 Oct 2016 18:40
check 2. Prints reply twice.

Edited by author 21.10.2016 18:47

Edited by author 21.10.2016 18:52