結果

問題 No.237 作図可能性
ユーザー 37zigen37zigen
提出日時 2016-08-25 16:04:16
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,028 bytes
コンパイル時間 3,362 ms
コンパイル使用メモリ 79,832 KB
実行使用メモリ 55,108 KB
最終ジャッジ日時 2024-04-25 15:19:32
合計ジャッジ時間 7,996 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
54,284 KB
testcase_01 AC 127 ms
54,012 KB
testcase_02 AC 120 ms
54,452 KB
testcase_03 AC 122 ms
54,120 KB
testcase_04 AC 122 ms
53,924 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 120 ms
54,336 KB
testcase_12 AC 132 ms
54,112 KB
testcase_13 AC 122 ms
54,204 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 109 ms
52,984 KB
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package No200番台;

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

public class Q237 {
	public static void main(String[] args) {
		new Q237().solver();
	}

	void solver() {
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long[] F = { 3, 5, 17, 257, 65537 };
		// 正n角形が作図可能
		// ⇔2のべき乗とフェルマー素数の積でかける。
		ArrayList<Long> s = new ArrayList<>();
		for (int i = 1; i < (1 << 4); i++) {
			long tmp = 1;
			for (int shift = 0; shift <= 4; shift++) {
				if (((i >> shift) & 1) == 1) {
					tmp *= F[shift];
				}
			}
			if (tmp != 1) {
				s.add(tmp);
			}
		}
		long ans = 0;
		for (int i = 0; i < s.size(); i++) {
			long d = s.get(i);
//			System.out.println(d);
			if (d <= A) {
				ans += (long) (Math.log((double) A / (double) d) / Math.log(2)) + 1;
			}
		}
		ans += (long) (Math.log(A) / Math.log(2)) - 1;
		System.out.println(ans);
	}

	void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}
0