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

Java как обычно
Posted by Chernobuk 19 Jul 2016 18:49
import java.util.*;
public class N1068 {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        if ((n>=1)&&(n<10000)) System.out.print(n *(n + 1) / 2);
        if ((n<1)&&(n>-10000)) System.out.print(-((-n) *(1 -n) / 2) + 1);
    }
}

что здесь не так?
Re: Java как обычно
Posted by Oleg Baskakov 19 Jul 2016 19:08
"Не превосходит" означает "меньше либо равно, но не больше"

Edited by author 19.07.2016 19:08
Re: Java как обычно
Posted by Chernobuk 19 Jul 2016 19:26
сори, был не прав