結果
問題 |
No.1152 10億ゲーム
|
ユーザー |
👑 ![]() |
提出日時 | 2020-10-03 18:30:57 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 951 bytes |
コンパイル時間 | 1,581 ms |
コンパイル使用メモリ | 168,808 KB |
実行使用メモリ | 25,488 KB |
平均クエリ数 | 24.76 |
最終ジャッジ日時 | 2024-07-17 07:01:16 |
合計ジャッジ時間 | 8,123 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 WA * 31 |
ソースコード
#include<bits/stdc++.h> using namespace std; using LL = long long; using ULL = unsigned long long; #define rep(i,n) for(int i=0; i<(n); i++) pair<int, int> g(int x) { pair<int, int> buf = { 0,0 }; while (x % 2 == 0) { buf.first++; x /= 2; } while (x % 5 == 0) { buf.second++; x /= 5; } return buf; } int main() { int x, y; cin >> x >> y; rep(i, 35) { pair<int, int> px = g(x), py = g(y); if ((px.first + px.second + py.first + py.second) % 2 == 0) { x *= 2; } else { if (abs(py.first - px.first) > abs(py.second - px.second)) { if (px.first < py.first) x *= 2; else x /= 2; } else { if (px.second < py.second) x *= 5; else x /= 5; } } cout << x << endl; if (x == y) break; cin >> y; if (x == y) break; } return 0; }