結果

問題 No.680 作れる数
ユーザー Grenache
提出日時 2018-04-28 00:21:24
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 869 bytes
コンパイル時間 3,344 ms
コンパイル使用メモリ 75,536 KB
実行使用メモリ 54,432 KB
最終ジャッジ日時 2024-06-27 23:04:23
合計ジャッジ時間 6,856 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10 WA * 10
権限があれば一括ダウンロードができます

ソースコード

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