結果
問題 | No.587 七対子 |
ユーザー |
![]() |
提出日時 | 2017-11-03 23:36:30 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 776 bytes |
コンパイル時間 | 520 ms |
コンパイル使用メモリ | 60,448 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 19:44:12 |
合計ジャッジ時間 | 1,608 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
#include <iostream> #include <algorithm> using namespace std; int main(){ char S[14]; for(int i=0; i<13; i++) cin >> S[i]; S[13]='\n'; sort(S, S+13); bool odd=0; char ans='\n'; for(int i=0; i<13; i++){ if(!odd){ if(S[i]==S[i+1] && S[i]!=S[i+2]){ i++; }else if(S[i]==S[i+1]){ ans = 'I'; break; }else{ ans = S[i]; odd = 1; } }else{ if(S[i]==S[i+1] && S[i]!=S[i+2]){ i++; }else{ ans = 'I'; break; } } } if(ans=='I' || ans=='\0' || ans=='\n')cout<<"Impossible\n"; else cout<<ans<<endl; return 0; }