結果
問題 |
No.548 国士無双
|
ユーザー |
|
提出日時 | 2019-04-10 21:56:11 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 625 bytes |
コンパイル時間 | 599 ms |
コンパイル使用メモリ | 66,376 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-17 14:57:35 |
合計ジャッジ時間 | 1,307 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 |
ソースコード
#include<iostream> using namespace std; int main(){ int a[13] = {}; string s; cin >> s; for(char c : s){ a[c-'a']++; } int two = 0, one = 0; for(int x : a){ if(x == 2) two++; if(x == 1) one++; } if(two > 1 || (two == 0 && one != 13) || (two == 1 && one != 11)){ cout << "Impossible" << endl; }else{ for(int i = 0; i < 13; i++){ if(two == 1 && a[i] == 0){ cout << (char)('a' + i) << endl; }else if(two == 0){ cout << (char)('a' + i) << endl; } } } return 0; }