結果
問題 |
No.3 ビットすごろく
|
ユーザー |
|
提出日時 | 2024-07-12 19:23:26 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 711 bytes |
コンパイル時間 | 3,119 ms |
コンパイル使用メモリ | 273,336 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-12 19:23:32 |
合計ジャッジ時間 | 4,871 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 WA * 18 |
ソースコード
#include <bits/stdc++.h> using namespace std; using Int = int64_t; using uInt = uint64_t; template <typename T> using min_heap = priority_queue<T, vector<T>, greater<T>>; template <typename T> using max_heap = priority_queue<T, vector<T>, less<T>>; void solve( /* Copyright by Urtusea */ ) { int n; cin >> n; int now = 1, cnt = 1; while (now < n) { now += __popcount(now); cnt += 1; } if (now == n) { cout << cnt << '\n'; } else { cout << -1 << '\n'; } } int main(int argc, char *argv[], char *envp[]) { cin.tie(nullptr)->sync_with_stdio(false); // for (int i = 1, n = (cin >> n, n); i <= n; i++) solve(); return 0; }