Submission #372256

# Submission time Handle Problem Language Result Execution time Memory
372256 2021-02-27T10:38:47 Z kutbilim_one Odd-even (IZhO11_oddeven) Java 11
100 / 100
145 ms 10824 KB
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
1 Correct 145 ms 10548 KB Output is correct
2 Correct 124 ms 10476 KB Output is correct
3 Correct 137 ms 10620 KB Output is correct
4 Correct 123 ms 10564 KB Output is correct
5 Correct 123 ms 10476 KB Output is correct
6 Correct 119 ms 10604 KB Output is correct
7 Correct 123 ms 10664 KB Output is correct
8 Correct 123 ms 10824 KB Output is correct
9 Correct 129 ms 10476 KB Output is correct
10 Correct 145 ms 10600 KB Output is correct
11 Correct 123 ms 10732 KB Output is correct
12 Correct 120 ms 10604 KB Output is correct
13 Correct 123 ms 10708 KB Output is correct
14 Correct 122 ms 10500 KB Output is correct
15 Correct 123 ms 10476 KB Output is correct
16 Correct 122 ms 10548 KB Output is correct
17 Correct 124 ms 10764 KB Output is correct
18 Correct 133 ms 10496 KB Output is correct
19 Correct 131 ms 10476 KB Output is correct
20 Correct 124 ms 10476 KB Output is correct
21 Correct 129 ms 10368 KB Output is correct
22 Correct 125 ms 10692 KB Output is correct