結果

問題 No.587 七対子
ユーザー kpinkcat
提出日時 2023-08-18 14:34:25
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 586 bytes
コンパイル時間 722 ms
コンパイル使用メモリ 105,080 KB
最終ジャッジ日時 2025-02-16 09:05:10
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>
#include<cctype>
#include<set>
#include<bitset>
#include<math.h>
#include<map>
#include<queue>
#include<iomanip>
using namespace std;
#ifdef _WIN32
#include <Windows.h>
#endif

int main()
{
    int p = 0, ans = 0, cnt = 0;
    string s;
    cin >> s;
    vector<int> v(26, 0);
    for (int i = 0; i < s.size(); i++) v[s[i] - 'a']++;
    for (int i = 0; i < 26; i++){
        if (v[i] == 2) p++;
        if (v[i] == 1) ans = i;
    }
    if (p == 6 && ans) cout << char('a' + ans) << endl;
    else cout << "Impossible" << endl;
}
0