結果
問題 |
No.1152 10億ゲーム
|
ユーザー |
👑 ![]() |
提出日時 | 2020-10-03 18:26:46 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 803 bytes |
コンパイル時間 | 1,579 ms |
コンパイル使用メモリ | 167,716 KB |
実行使用メモリ | 25,476 KB |
平均クエリ数 | 25.28 |
最終ジャッジ日時 | 2024-07-17 07:01:06 |
合計ジャッジ時間 | 8,426 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 WA * 30 |
ソースコード
#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; while (true) { pair<int, int> px = g(x), py = g(y); 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; }