結果
問題 | No.587 七対子 |
ユーザー |
|
提出日時 | 2017-11-03 22:33:33 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 845 bytes |
コンパイル時間 | 457 ms |
コンパイル使用メモリ | 54,776 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 19:42:38 |
合計ジャッジ時間 | 1,475 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
#include <iostream>using namespace std;int main(){string S;cin >> S;char alphabets[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y','z'};int in_alphabets[26] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};for(int i = 0; i < 13; i++){for(int j = 0; j < 26; j++){if(S[i] == alphabets[j]){in_alphabets[j]++;break;}}}int one = -1;for(int i = 0; i < 26; i++){if((in_alphabets[i] == 1 && one != -1) || in_alphabets[i] >= 3){cout << "Impossible" << endl;return 0;}else if(in_alphabets[i] == 1){one = i;}}cout << alphabets[one] << endl;}