Submission #64567193


Source Code Expand

import java.util.*;
public class Main{

	static long solve(long n , long a){
		long k = (long)Math.pow(2, a);
		long p =  (long)Math.sqrt(n/k);
		return p;
	}

	static long solve2(double n){
		HashSet<Double> hash = new HashSet<>();
		double a = 1;
		double b = 1;
		while(true){
			double c  = Math.pow(2,a);
			double d  = Math.pow(b, 2);
			double p = c*d;
			if (c>n) {
				break;
			} 
			if( p>n){
				a++;
				b=1;
				continue;
			}
			b++;
			hash.add(p);
		}
		return hash.size();
		//System.out.println(hash.size());
	}
    public static void main (String[] args) throws java.lang.Exception{
		Scanner s = new Scanner(System.in);

		long n =s.nextLong();
		long r = solve(n-1, 1) + solve(n+1, 2);
		System.out.println(r);
// 		for(long n = 10000000; n< 999999999; n++){
// 			long r = solve(n+1, 1) + solve(n+1, 2);

// 			long p= solve2((double)n);
// 			if (p != r) {
// 				System.out.println("n = " + n);
// 			}
// //			System.out.println(r);
// 		}
		

   	}	
}

Submission Info

Submission Time
Task C - 2^a b^2
User Reuben9027
Language Java (OpenJDK 17)
Score 0
Code Size 1027 Byte
Status WA
Exec Time 67 ms
Memory 38156 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 350
Status
AC × 3
AC × 24
WA × 5
Set Name Test Cases
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt
Case Name Status Exec Time Memory
example_00.txt AC 66 ms 38076 KiB
example_01.txt AC 65 ms 37832 KiB
example_02.txt AC 64 ms 37848 KiB
hand_00.txt AC 63 ms 37816 KiB
hand_01.txt WA 66 ms 37816 KiB
hand_02.txt AC 66 ms 38048 KiB
hand_03.txt AC 66 ms 38076 KiB
hand_04.txt WA 65 ms 38084 KiB
hand_05.txt WA 65 ms 38044 KiB
hand_06.txt WA 66 ms 38092 KiB
hand_07.txt AC 66 ms 38080 KiB
hand_08.txt AC 66 ms 37928 KiB
hand_09.txt WA 64 ms 37896 KiB
hand_10.txt AC 64 ms 37864 KiB
random_00.txt AC 67 ms 38060 KiB
random_01.txt AC 66 ms 38144 KiB
random_02.txt AC 65 ms 37908 KiB
random_03.txt AC 67 ms 37876 KiB
random_04.txt AC 66 ms 38156 KiB
random_05.txt AC 65 ms 38088 KiB
random_06.txt AC 64 ms 37768 KiB
random_07.txt AC 66 ms 38144 KiB
random_08.txt AC 66 ms 38076 KiB
random_09.txt AC 64 ms 37844 KiB
random_10.txt AC 65 ms 37896 KiB
random_11.txt AC 65 ms 37792 KiB
random_12.txt AC 63 ms 37816 KiB
random_13.txt AC 64 ms 38088 KiB
random_14.txt AC 67 ms 37848 KiB