|
|
back to boardDiscussion of Problem 1068. SumOn 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 |
|
|