結果

問題 No.548 国士無双
ユーザー nCk_cv
提出日時 2017-09-01 02:14:25
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 822 bytes
コンパイル時間 592 ms
コンパイル使用メモリ 76,536 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-17 13:45:03
合計ジャッジ時間 1,482 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>

#define AS(a) (sizeof(a)/sizeof(a[0]))
using namespace std;
long long int MOD = 1000000007;
long long int INF = 1000000007;


int main() {
  string s;
  cin >> s;
  int cou[26];
  for(int i = 0; i < 26; i++) {
    cou[i] = 0;
  }
  for(int i = 0; i < s.length(); i++) {
    cou[s[i] - 'a']++;
  }
  int id = -1;

  for(int i = 0; i < 13; i++) {
    if(cou[i] == 0 && id == -1) {
      id = i;
    } else if(cou[i] == 0 && id != -1) {
      id = -2;
    }
  }
  if(id == -2) {
    cout << "Impossible" << endl;
  }
  else if(id == -1) {
    for(int i = 0; i < 13; i++) {
      cout << (char)('a' + i) << endl;
    }
  }
  else {
    cout << (char)('a' + id) << endl;
  }

}

0