結果

問題 No.237 作図可能性
ユーザー neko_the_shadowneko_the_shadow
提出日時 2019-05-20 18:00:32
言語 Java21
(openjdk 21)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 752 bytes
コンパイル時間 2,735 ms
コンパイル使用メモリ 74,376 KB
実行使用メモリ 41,104 KB
最終ジャッジ日時 2023-10-17 08:07:58
合計ジャッジ時間 8,004 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
40,980 KB
testcase_01 AC 132 ms
41,032 KB
testcase_02 AC 131 ms
41,036 KB
testcase_03 AC 132 ms
40,932 KB
testcase_04 AC 131 ms
40,908 KB
testcase_05 AC 131 ms
41,008 KB
testcase_06 AC 133 ms
40,944 KB
testcase_07 AC 132 ms
40,908 KB
testcase_08 AC 134 ms
41,100 KB
testcase_09 AC 134 ms
41,068 KB
testcase_10 AC 131 ms
41,044 KB
testcase_11 AC 131 ms
41,040 KB
testcase_12 AC 132 ms
41,036 KB
testcase_13 AC 133 ms
41,008 KB
testcase_14 AC 132 ms
41,012 KB
testcase_15 AC 132 ms
40,912 KB
testcase_16 AC 133 ms
41,040 KB
testcase_17 AC 135 ms
41,040 KB
testcase_18 AC 136 ms
41,036 KB
testcase_19 AC 130 ms
41,012 KB
testcase_20 AC 131 ms
41,104 KB
testcase_21 AC 132 ms
40,908 KB
testcase_22 AC 133 ms
41,068 KB
testcase_23 AC 130 ms
40,932 KB
testcase_24 AC 131 ms
40,904 KB
testcase_25 AC 131 ms
41,008 KB
testcase_26 AC 133 ms
40,904 KB
testcase_27 AC 129 ms
40,980 KB
testcase_28 AC 130 ms
41,032 KB
testcase_29 AC 133 ms
41,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        long a = stdin.nextInt();
        
        int count = 0;
        long[] primes = new long[] {3, 5, 17, 257, 65537}; // フェルマー素数
        for (long bit = 0, len = primes.length; bit < (1 << len); bit++) {
            long x = 1;
            for (int i = 0; i < len; i++) {
                if ((bit & (1 << i)) != 0) {
                    x *= primes[i];
                }
            }
            while (x <= a) {
                if (x >= 3) {
                    count++;
                }
                x *= 2;
            }
        }
        
        System.out.println(count);
    }
}
0