結果
問題 | No.1152 10億ゲーム |
ユーザー | beet |
提出日時 | 2020-08-07 23:07:17 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,086 bytes |
コンパイル時間 | 2,240 ms |
コンパイル使用メモリ | 199,408 KB |
実行使用メモリ | 24,480 KB |
平均クエリ数 | 25.28 |
最終ジャッジ日時 | 2023-09-24 04:57:30 |
合計ジャッジ時間 | 6,772 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 59 ms
24,360 KB |
testcase_01 | AC | 54 ms
23,868 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 53 ms
24,300 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 52 ms
23,604 KB |
testcase_09 | AC | 55 ms
23,484 KB |
testcase_10 | AC | 52 ms
23,340 KB |
testcase_11 | AC | 54 ms
23,592 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 53 ms
24,096 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 54 ms
23,604 KB |
testcase_21 | AC | 52 ms
24,312 KB |
testcase_22 | AC | 54 ms
23,712 KB |
testcase_23 | AC | 53 ms
24,360 KB |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | AC | 55 ms
24,360 KB |
testcase_39 | AC | 54 ms
23,436 KB |
testcase_40 | AC | 54 ms
24,096 KB |
testcase_41 | AC | 58 ms
24,312 KB |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | AC | 54 ms
23,340 KB |
testcase_47 | AC | 53 ms
23,592 KB |
testcase_48 | AC | 54 ms
24,312 KB |
testcase_49 | AC | 54 ms
23,460 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; using Int = long long; const char newl = '\n'; template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;} template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);} template<typename T=int> vector<T> read(size_t n){ vector<T> ts(n); for(size_t i=0;i<n;i++) cin>>ts[i]; return ts; } //INSERT ABOVE HERE using P = pair<int, int>; P pos(int x){ int r=0,c=0; while(x%2==0) r++,x/=2; while(x%5==0) c++,x/=5; return P(r,c); } int val(int r,int c){ int x=1; for(int i=0;i<r;i++) x*=2; for(int j=0;j<c;j++) x*=5; return x; } signed main(){ int x1,x2; cin>>x1>>x2; while(1){ auto [r1,c1]=pos(x1); auto [r2,c2]=pos(x2); int ddr=0,ddc=0; if(abs(r2-r1)>abs(c2-c1)){ ddr=(r2-r1)/abs(r2-r1); }else{ ddc=(c2-c1)/abs(c2-c1); } int nr=r1+ddr,nc=c1+ddc; x1=val(nr,nc); cout<<x1<<endl; if(x1==x2) return 0; cin>>x2; if(x1==x2) return 0; } return 0; }