結果

問題 No.587 七対子
ユーザー newlife171128
提出日時 2017-12-15 22:01:54
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 738 bytes
コンパイル時間 696 ms
コンパイル使用メモリ 83,592 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-19 19:48:23
合計ジャッジ時間 1,648 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <sstream>
#include<sstream>
#include <queue>
#include <limits>
#include <cstdlib>
#include <deque>
#include <map>
#include <set>
#include <iomanip>
using namespace std;



int main() {

	string s;
	cin>>s;

	int alph[26] ={};

	for(int i=0; i<s.length(); i++){
		alph[(int)s[i]-(int)'a'] += 1;
	}

	int alphcount=0;
	int two_times=0;
	int ans=0;
	for(int i=0; i<26; i++){

		if(alph[i] == 2){
			two_times++;
		}
		if(alph[i] !=0){
			alphcount++;
		}
		if(alph[i] ==1){
			ans = i;
		}
	}

	if(alphcount ==7 && two_times ==6){
		cout<<(char)(ans+(int)'a')<<endl;
	}else {
		cout<<"Impossible"<<endl;
	}
	return 0;
}
0