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

On Eclipse working perfect. Why WA?
Posted by yohoho 28 Dec 2013 05:22
import java.util.Scanner;


public class Test {

    public static void main(String[] args) {

Scanner in = new Scanner(System.in);
float b = 0;
float a = in.nextInt();

in.close();


if ( a >= 1) {

    b =  ((a + 1) /2) * a;



    System.out.println((int)b);}

else


{
    b = ((-a + 1) /2) * -a;

System.out.println((int)-b+1);}

}}

Edited by author 28.12.2013 05:22