結果
| 問題 | No.638 Sum of "not power of 2" |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-12-11 17:14:40 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 0 ms / 1,000 ms |
| コード長 | 491 bytes |
| 記録 | |
| コンパイル時間 | 303 ms |
| コンパイル使用メモリ | 80,388 KB |
| 実行使用メモリ | 9,268 KB |
| 最終ジャッジ日時 | 2026-07-06 06:56:17 |
| 合計ジャッジ時間 | 1,463 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 12 |
ソースコード
#include <iostream>
#include <cstdint>
using namespace std;
constexpr uint16_t pop_count(uint64_t a) noexcept
{
uint16_t ans = UINT16_C(0);
for (; a != UINT64_C(0); a >>= UINT64_C(1))
if (a & UINT64_C(1)) ++ans;
return ans;
}
int main()
{
cin.tie(nullptr);
ios::sync_with_stdio(false);
uint64_t N, i;
cin >> N;
for (i = 1; i != N; ++i)
if (pop_count(i) != 1 && pop_count(N - i) != 1)
{
cout << i << ' ' << N - i << '\n';
return 0;
}
cout << "-1\n";
return 0;
}