結果
| 問題 | 
                            No.1152 10億ゲーム
                             | 
                    
| コンテスト | |
| ユーザー | 
                             Rubikun
                         | 
                    
| 提出日時 | 2020-08-07 22:41:43 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 3,099 bytes | 
| コンパイル時間 | 1,799 ms | 
| コンパイル使用メモリ | 178,140 KB | 
| 実行使用メモリ | 25,472 KB | 
| 平均クエリ数 | 23.82 | 
| 最終ジャッジ日時 | 2024-07-17 04:58:39 | 
| 合計ジャッジ時間 | 8,669 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 48 WA * 2 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=200005,INF=1<<30,D=1000000000;
int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int x1,x2;cin>>x1>>x2;
    map<int,int> MA,MA2,MA5;
    
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            int a=1;
            for(int k=0;k<i;k++) a*=2;
            for(int k=0;k<j;k++) a*=5;
            
            MA[a]=i+j;
            MA2[a]=i;
            MA5[a]=j;
        }
    }
    
    int t=0;
    
    while(1){
        
        if(x1/2==x2||x1/5==x2||x1*2==x2||x1*5==x2||(x1==D/4&&x2==D)){
            cout<<x2<<endl;
            return 0;
        }
        
        int pa=abs(MA[x1]-MA[x2])&1;
        
        if(x1==D&&pa) break;
        
        if(x1==D/2){
            if(pa){
                break;
            }else{
                cout<<D/4<<endl;
                x1=D/4;
            }
        }else if(x1==D/4){
            if(pa){
                break;
            }else{
                cout<<D<<endl;
                x1=D;
            }
        }else if(MA2[x1]>=8){
            cout<<x1/2<<endl;
            x1/=2;
        }else if(MA2[x1]<7){
            cout<<x1*2<<endl;
            x1*=2;
        }else{
            cout<<x1*5<<endl;
            x1*=5;
        }
        
        if(x1==x2) return 0;
        
        cin>>x2;
        
        t++;
        
        if(x1==x2) return 0;
    }
    
    while(1){
        
        if(x1/2==x2||x1/5==x2||x1*2==x2||x1*5==x2||(x1==D/4&&x2==D)){
            cout<<x2<<endl;
            return 0;
        }
        
        int a=MA2[x1]-MA2[x2],b=MA5[x1]-MA5[x2];
        
        if(x1==D){
            cout<<x1/2<<endl;
            x1/=2;
        }else if(x1==D/2){
            cout<<x1/2<<endl;
            x1/=2;
        }else if(abs(a)==1){
            if(b>0){
                cout<<x1/5<<endl;
                x1/=5;
            }else{
                cout<<x1*5<<endl;
                x1*=5;
            }
        }else if(abs(b)==1){
            if(a>0){
                cout<<x1/2<<endl;
                x1/=2;
            }else{
                cout<<x1*2<<endl;
                x1*=2;
            }
        }else if(abs(a)&1){
            if(a>0){
                cout<<x1/2<<endl;
                x1/=2;
            }else{
                cout<<x1*2<<endl;
                x1*=2;
            }
        }else if(abs(b)&1){
            if(b>0){
                cout<<x1/5<<endl;
                x1/=5;
            }else{
                cout<<x1*5<<endl;
                x1*=5;
            }
        }
        
        cin>>x2;
        
        if(x1==x2) return 0;
        
        t++;
        
    }
}
            
            
            
        
            
Rubikun