結果
| 問題 |
No.548 国士無双
|
| コンテスト | |
| ユーザー |
xuelei
|
| 提出日時 | 2018-07-21 02:41:47 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 575 bytes |
| コンパイル時間 | 438 ms |
| コンパイル使用メモリ | 55,544 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-17 14:51:56 |
| 合計ジャッジ時間 | 1,172 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 |
ソースコード
#include <iostream>
using namespace std;
int main(){
string s;
cin >> s;
int a[13]={};
for(int i=0;i<s.size();i++){
int k=s[i]-'a';
if(k<13)a[k]++;
}
int c=0,c1=0,c2=0;
for(int i=0;i<13;i++){
if(a[i]==0)c=i;
else if(a[i]==1)c1++;
else if(a[i]==2)c2++;
else{
cout << "Impossible" << endl;
return 0;
}
}
char ans='a'+c;
if(c2==1 && c1==11)cout << ans << endl;
else if(c1==13){
for(int i=0;i<13;i++){
char ans='a'+i;
cout << ans << endl;
}
}else cout << "Impossible" << endl;
return 0;
}
xuelei