結果

問題 No.680 作れる数
ユーザー GrenacheGrenache
提出日時 2018-04-28 00:21:24
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 869 bytes
コンパイル時間 4,621 ms
コンパイル使用メモリ 72,748 KB
実行使用メモリ 57,396 KB
最終ジャッジ日時 2023-09-10 07:33:48
合計ジャッジ時間 8,159 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,480 KB
testcase_01 AC 119 ms
55,824 KB
testcase_02 AC 122 ms
55,704 KB
testcase_03 AC 122 ms
55,636 KB
testcase_04 AC 120 ms
55,920 KB
testcase_05 WA -
testcase_06 AC 122 ms
55,700 KB
testcase_07 WA -
testcase_08 AC 122 ms
55,944 KB
testcase_09 WA -
testcase_10 AC 121 ms
55,844 KB
testcase_11 AC 121 ms
55,708 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 122 ms
55,464 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();

		if (n == 0) {
			pr.println("YES");
		} else {
			int m = Integer.highestOneBit(n);
			if ((n & (m >> 1)) != 0) {
				if (n != (m << 1) - 1) {
					pr.println("NO");
				} else {
					pr.println("YES");
				}
			} else {
				pr.println("YES");
			}
		}
	}

	// ---------------------------------------------------
	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