結果

問題 No.237 作図可能性
ユーザー YamaKasaYamaKasa
提出日時 2018-09-05 22:35:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 144 ms / 2,000 ms
コード長 1,047 bytes
コンパイル時間 2,337 ms
コンパイル使用メモリ 77,296 KB
実行使用メモリ 54,552 KB
最終ジャッジ日時 2024-04-27 14:38:45
合計ジャッジ時間 7,405 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
54,168 KB
testcase_01 AC 121 ms
53,124 KB
testcase_02 AC 133 ms
54,092 KB
testcase_03 AC 132 ms
53,900 KB
testcase_04 AC 135 ms
54,272 KB
testcase_05 AC 132 ms
54,068 KB
testcase_06 AC 133 ms
54,224 KB
testcase_07 AC 132 ms
54,272 KB
testcase_08 AC 142 ms
54,300 KB
testcase_09 AC 136 ms
54,292 KB
testcase_10 AC 144 ms
54,100 KB
testcase_11 AC 139 ms
54,192 KB
testcase_12 AC 138 ms
54,552 KB
testcase_13 AC 135 ms
54,084 KB
testcase_14 AC 131 ms
54,364 KB
testcase_15 AC 133 ms
54,344 KB
testcase_16 AC 133 ms
54,116 KB
testcase_17 AC 136 ms
53,996 KB
testcase_18 AC 133 ms
54,332 KB
testcase_19 AC 136 ms
54,352 KB
testcase_20 AC 134 ms
54,244 KB
testcase_21 AC 133 ms
54,308 KB
testcase_22 AC 135 ms
54,520 KB
testcase_23 AC 136 ms
54,216 KB
testcase_24 AC 133 ms
54,176 KB
testcase_25 AC 123 ms
53,076 KB
testcase_26 AC 137 ms
54,236 KB
testcase_27 AC 132 ms
54,340 KB
testcase_28 AC 132 ms
54,012 KB
testcase_29 AC 134 ms
54,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	static long []b;
	static long[]F = {3, 5, 17, 257, 65537};
	static int cnt = 0;
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		scan.close();

		long []a = new long[30];
		for(int i = 0; i < 30; i++) {
			a[i] = (long)Math.pow(2, i);
		}
		b = new long[32];


		int[] bit = new int[5];
		rec(0, 5, bit);
		Arrays.sort(b);

		int ans = 0;
		for(int i = 0; i < 30; i++) {
			for(int j = 0; j < 32; j++) {
				long t = a[i] * b[j];
				if(3 <= t &&t <= A) {
					ans++;
				}
			}
		}
		System.out.println(ans);

	}
	static void rec(int k, int n, int[] S) {
        if(k == n) {
            long t = calc(S);
            b[cnt] = t;
        	cnt ++;
            return;
        }
        rec(k + 1, n, S);
        S[k] = 1;
        rec(k + 1,n, S);
        S[k] = 0;
    }
	static long calc(int[] S) {
		long t = 1;
		for(int i = 0; i < S.length; i++) {
			if(S[i] == 1) {
				t *= F[i];
			}
		}
		return t;
	}

}
0