結果

問題 No.587 七対子
ユーザー Kutimoti_T
提出日時 2018-06-12 23:58:55
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 492 bytes
コンパイル時間 1,392 ms
コンパイル使用メモリ 166,664 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-19 19:53:42
合計ジャッジ時間 2,411 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)

string s;
int main(){
  cin >> s;
  for(char add = 'a';add <= 'z';add++){
    map<char, int> mp;
    string t = s;
    t.push_back(add);
    for (char c : t)
      mp[c]++;
    bool ok = true;
 
    for(auto p : mp){
      ok = ok && p.second == 2;
    }

    if(ok){
      cout << add << endl;
      return 0;
    }
  }

  cout << "Impossible" << endl;
  return 0;
}
0