結果

問題 No.680 作れる数
ユーザー GrenacheGrenache
提出日時 2018-04-28 01:39:29
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 807 bytes
コンパイル時間 3,588 ms
コンパイル使用メモリ 72,728 KB
実行使用メモリ 56,024 KB
最終ジャッジ日時 2023-09-10 07:41:17
合計ジャッジ時間 7,299 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,684 KB
testcase_01 AC 125 ms
55,652 KB
testcase_02 AC 125 ms
55,796 KB
testcase_03 AC 124 ms
55,616 KB
testcase_04 AC 123 ms
55,720 KB
testcase_05 AC 126 ms
55,376 KB
testcase_06 AC 125 ms
53,612 KB
testcase_07 AC 125 ms
55,700 KB
testcase_08 AC 125 ms
55,416 KB
testcase_09 AC 126 ms
55,676 KB
testcase_10 AC 124 ms
55,624 KB
testcase_11 AC 123 ms
55,832 KB
testcase_12 AC 128 ms
56,024 KB
testcase_13 AC 124 ms
55,872 KB
testcase_14 AC 124 ms
55,412 KB
testcase_15 AC 123 ms
55,836 KB
testcase_16 AC 124 ms
55,644 KB
testcase_17 AC 123 ms
55,404 KB
testcase_18 AC 122 ms
55,692 KB
testcase_19 AC 125 ms
55,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main_yukicoder680_1 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();

		for (int m = (0x1 << 30) - 1; n > 2 && m > 0; m /= 2) {
			if (n >= m) {
				n -= m;
			}
		}

		if (n == 0 || n == 1) {
			pr.println("YES");
		} else if (n >= 2) {
			pr.println("NO");
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(INPUT == null ? System.in : new ByteArrayInputStream(INPUT.getBytes()));
		pr = new Printer(System.out);

		solve();

//		pr.close();
		pr.flush();
//		sc.close();
	}

	static String INPUT = null;

	private static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}
0