結果

問題 No.832 麻雀修行中
ユーザー YkMlqYkMlq
提出日時 2019-05-24 23:04:11
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 231 ms / 2,000 ms
コード長 1,734 bytes
コンパイル時間 3,409 ms
コンパイル使用メモリ 182,948 KB
実行使用メモリ 4,604 KB
最終ジャッジ日時 2023-10-17 14:22:39
合計ジャッジ時間 12,158 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 229 ms
4,604 KB
testcase_01 AC 230 ms
4,604 KB
testcase_02 AC 230 ms
4,604 KB
testcase_03 AC 229 ms
4,604 KB
testcase_04 AC 230 ms
4,604 KB
testcase_05 AC 230 ms
4,604 KB
testcase_06 AC 230 ms
4,604 KB
testcase_07 AC 230 ms
4,604 KB
testcase_08 AC 230 ms
4,604 KB
testcase_09 AC 230 ms
4,604 KB
testcase_10 AC 229 ms
4,604 KB
testcase_11 AC 229 ms
4,604 KB
testcase_12 AC 229 ms
4,604 KB
testcase_13 AC 229 ms
4,604 KB
testcase_14 AC 230 ms
4,604 KB
testcase_15 AC 229 ms
4,604 KB
testcase_16 AC 230 ms
4,604 KB
testcase_17 AC 231 ms
4,604 KB
testcase_18 AC 229 ms
4,604 KB
testcase_19 AC 229 ms
4,604 KB
testcase_20 AC 229 ms
4,604 KB
testcase_21 AC 229 ms
4,604 KB
testcase_22 AC 230 ms
4,604 KB
testcase_23 AC 229 ms
4,604 KB
testcase_24 AC 230 ms
4,604 KB
testcase_25 AC 231 ms
4,604 KB
testcase_26 AC 228 ms
4,604 KB
testcase_27 AC 229 ms
4,604 KB
testcase_28 AC 229 ms
4,604 KB
testcase_29 AC 230 ms
4,604 KB
testcase_30 AC 230 ms
4,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using ll = long long;
using namespace std;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

string S;
set<string> ps;

void pool(){
    vector<int> bo = {111,222,333,444,555,666,777,888,999,123,234,345,456,567,678,789};
    vector<int> at = {11,22,33,44,55,66,77,88,99};
    rep(i,sz(at)) rep(j,sz(bo)) rep(k,sz(bo)) rep(l,sz(bo)) rep(m,sz(bo)){
        string res = to_string(at[i])+to_string(bo[j])+to_string(bo[k])+to_string(bo[l])+to_string(bo[m]);
        bool flag = true;
        sort(ALL(res));
        repi(i,'1','9') if(count(ALL(res),i) > 4) flag = false;
        if(flag) ps.insert(res);
    }
    return;
}

bool judge(string s){
    sort(ALL(s));
    bool flag = false;
    map<char,int> hai;
    rep(i,sz(s)) hai[s[i]]++;

    //条件2
    int ct = 0;
    repi(i,'1','9') if(hai[i] == 2) ct++;
    if(ct == 7) flag = true;
    
    //条件1
    if(ps.find(s) != ps.end()) flag = true;
    
    return flag;
}

int main(){
    cin >> S;
    pool();
    
    repi(i,'1','9'){
        string T = S + (char)i;
        if(judge(T)) cout << (char)i << endl;
    }
}
0