Submission #372256

#TimeUsernameProblemLanguageResultExecution timeMemory
372256kutbilim_oneOdd-even (IZhO11_oddeven)Java
100 / 100
145 ms10824 KiB
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 timeMemoryGrader output
Fetching results...