結果
問題 |
No.3 ビットすごろく
|
ユーザー |
![]() |
提出日時 | 2019-05-15 08:18:22 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 504 bytes |
コンパイル時間 | 455 ms |
コンパイル使用メモリ | 57,920 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-13 14:21:30 |
合計ジャッジ時間 | 1,803 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 WA * 15 |
ソースコード
#include<iostream> #include<string> #include<math.h> #include<stdlib.h> #include<string> using namespace std; int main() { int n; int masu = 1; int s = 0; int k; cin >> n; for (int i = 1; i <= 1000000; i++) { if (masu == n) { cout << i ; break; } k = masu; for (int j = 1; j <= 1000000; j++) { s = k % 2 + s; k = k / 2 ; if (k == 0) { break; } } masu = s + masu; if (masu > n) { masu = masu - s*2; } s = 0; if (i == 1000000) { cout << -1; } } }