結果

問題 No.587 七対子
ユーザー hiragn
提出日時 2019-07-19 02:45:04
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 575 bytes
コンパイル時間 1,572 ms
コンパイル使用メモリ 173,116 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-19 20:00:07
合計ジャッジ時間 2,490 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
    string s;
    cin >> s;

    map<char, int> mp;
    for (char i : s) {
        mp[i]++;
    }

    int one = 0, two = 0;
    string ans;
    for (char c = 'a'; c <= 'z'; ++c) {
        switch (mp[c]) {
            case 1:
                one++;
                ans = c;
                break;
            case 2:
                two++;
                break;
        }
    }

    if (one == 1 && two == 6) {
        cout << ans << endl;
    } else {
        cout << "Impossible" << endl;
    }
    return 0;
}
0