結果
| 問題 | No.587 七対子 | 
| コンテスト | |
| ユーザー |  SSRS | 
| 提出日時 | 2020-08-24 09:58:07 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 465 bytes | 
| コンパイル時間 | 894 ms | 
| コンパイル使用メモリ | 77,732 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-19 20:16:28 | 
| 合計ジャッジ時間 | 1,819 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 35 | 
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
	string S;
	cin >> S;
	char ans = '#';
	for (int i = 0; i < 26; i++){
		string T = S + (char) ('a' + i);
		vector<int> cnt(26, 0);
		for (int j = 0; j < 14; j++){
			cnt[T[j] - 'a']++;
		}
		sort(cnt.rbegin(), cnt.rend());
		if (cnt[6] == 2){
			ans = 'a' + i;
		}
	}
	if (ans == '#'){
		cout << "Impossible" << endl;
	} else {
		cout << ans << endl;
	}
}
            
            
            
        