結果
問題 | No.680 作れる数 |
ユーザー | anta |
提出日時 | 2018-04-27 22:50:31 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 357 bytes |
コンパイル時間 | 1,448 ms |
コンパイル使用メモリ | 167,496 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-27 22:06:30 |
合計ジャッジ時間 | 2,183 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include "bits/stdc++.h" using namespace std; int main() { //2x - popcnt(x) int N; while (~scanf("%d", &N)) { bool ans = false; for (int i = 0; i <= 31; ++ i) { int x = N + i; if (x % 2) continue; x /= 2; int p = 0; for (int j = 0; j < 31; ++ j) p += x >> j & 1; if (p == i) ans = true; } puts(ans ? "YES" : "NO"); } }