結果

問題 No.680 作れる数
ユーザー aporo_eeicaporo_eeic
提出日時 2018-07-10 23:32:28
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 468 bytes
コンパイル時間 695 ms
コンパイル使用メモリ 69,848 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-10-12 00:55:45
合計ジャッジ時間 1,683 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 1 ms
4,352 KB
testcase_04 AC 1 ms
4,356 KB
testcase_05 WA -
testcase_06 AC 1 ms
4,352 KB
testcase_07 WA -
testcase_08 AC 2 ms
4,372 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 2 ms
4,352 KB
testcase_13 WA -
testcase_14 AC 2 ms
4,352 KB
testcase_15 WA -
testcase_16 AC 1 ms
4,352 KB
testcase_17 WA -
testcase_18 AC 1 ms
4,348 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>

bool check(int seed) {
	int minS = 1;
	int minT = 1;
	int maxS = 1;
	int maxT = 1;
	while (minS < seed) {
		minT = 2 * minT;
		minS = minS + minT;
		maxT = 2 * maxT+1;
		maxS = maxS + maxT;
		if (minS <= seed and seed <= maxS) {
			return true;
		}
	}
	return false;
}

int main(void) {
	int seed; std::cin >> seed;
	bool result = check(seed);
	std::string ans = (result == true ? "YES" : "NO");
	std::cout << ans.c_str() << std::endl;
	return 0;
}
0