# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
372256 | kutbilim_one | Odd-even (IZhO11_oddeven) | Java | 145 ms | 10824 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
import java.util.*;
import java.math.*;
public class oddeven{
public static void main(String args[]){
Scanner cin = new Scanner(System.in);
/// 2*n - floor( (1+ sqrt(8*n-7))/2 )
BigInteger n = cin.nextBigInteger();
BigInteger sqrtPart = n.multiply(BigInteger.valueOf(8)).subtract(BigInteger.valueOf(7)).sqrt().add(BigInteger.valueOf(1)).divide(BigInteger.valueOf(2));
BigInteger res = n.multiply(BigInteger.valueOf(2)).subtract(sqrtPart);
System.out.print(res);
cin.close();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |