結果

問題 No.587 七対子
ユーザー 西尾
提出日時 2018-03-16 17:19:43
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 472 bytes
コンパイル時間 1,508 ms
コンパイル使用メモリ 166,092 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-19 19:51:15
合計ジャッジ時間 2,434 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

char S[ 20 ];
int A[ 30 ];

int main()
{
int i;
int x;
int iCnt1;
char C;

	cin >> S;

	for( i = 0; i < 13; i++ )
	{
		if( ++A[ S[ i ] - 'a' ] > 2 )
		{
			cout << "Impossible" << endl;

			return 0;
		}
	}

	C = '\0';
	iCnt1 = 0;
	for( i = 0; i < 26; i++ )
	{
		if( A[ i ] == 1 )
		{
			if( ++iCnt1 > 1 )
			{
				cout << "Impossible" << endl;

				return 0;
			}

			C = 'a' + i;
		}
	}

	cout << C << endl;

	return 0;
}

0