結果

問題 No.355 数当てゲーム(2)
ユーザー sugarrrsugarrr
提出日時 2018-07-23 01:18:15
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 2,336 bytes
コンパイル時間 648 ms
コンパイル使用メモリ 79,988 KB
実行使用メモリ 36,032 KB
最終ジャッジ日時 2023-09-23 16:10:40
合計ジャッジ時間 7,184 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>

using namespace std;
typedef long long ll;
#define i_7 1000000007
#define i_5 1000000005

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=1000000000000;/*10^12*/
#define rep(i,l,r) for(ll i=l;i<=r;i++)
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}


//////////////////////////////////////
#define koko 0

int main(){
    int q[100][6];
    rep(i,0,koko-1){
        int a[4];
        bool flag=true;
        while(flag){
            rep(j,0,3){
                a[j]=(int)rand()%10;
            }
            set<int>s;
            rep(j,0,3)s.insert(a[j]);
            if(s.size()==4){
                flag=false;
            }
        }
        rep(j,0,3)q[i][j]=a[j];
        rep(j,0,3)cout<<q[i][j]<<" ";
        fflush(stdout);
        cin>>q[i][4]>>q[i][5];
        if(q[i][4]==4&&q[i][5]==0){
            return 0;
        }

    }
    int pos=koko;
    rep(i,0,9999){
        int b[4];
        int c=i;
        rep(j,0,3){
            b[3-j]=c%10;
            c/=10;
        }
        set<int>s;
        rep(j,0,3)s.insert(b[j]);
        if(s.size()==4){
            bool flag=true;
            rep(j,0,pos-1){
                int coua=0;
                rep(k,0,3){
                    if(b[k]==q[j][k])coua++;
                }
                if(coua!=q[j][4]){
                    flag=false;break;
                }
                int coub=-coua;
                rep(k,0,3){
                    rep(l,0,3){
                        if(b[k]==q[j][l])coub++;
                    }
                }
                if(coub!=q[j][5]){
                    flag=false;break;
                }
            }
            if(flag){
                rep(j,0,3)q[pos][j]=b[j];
                rep(j,0,3)cout<<b[j]<<" ";
                fflush(stdout);
                cin>>q[pos][4]>>q[pos][5];
                if(q[pos][4]==4&&q[pos][5]==0){
                    return 0;
                }
                pos++;
            }
        }
    }
    
    
    return 0;
}
0