結果
| 問題 |
No.587 七対子
|
| コンテスト | |
| ユーザー |
yukiteru
|
| 提出日時 | 2018-02-05 16:08:36 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 938 bytes |
| コンパイル時間 | 673 ms |
| コンパイル使用メモリ | 82,676 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-07 22:32:21 |
| 合計ジャッジ時間 | 2,018 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 WA * 8 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:59:23: warning: 'p' may be used uninitialized [-Wmaybe-uninitialized]
59 | printf("%c\n", p + 'a' - 1);
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~
main.cpp:27:13: note: 'p' was declared here
27 | int p;
| ^
ソースコード
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<list>
#include<bitset>
#include<functional>
#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265358979
using namespace std;
typedef pair<int, int> P;
int main(void) {
string s;
int dp[27] = {};
int p;
bool flag = true;
cin >> s;
FOR(i, 0, 12) {
FOR(t, 1, 26) {
if (s[i] == 'a' + t - 1) {
dp[t]++;
break;
}
}
}
FOR(i, 1, 26) {
if (dp[i] >= 3) {
flag = false;
break;
}
if (dp[i] % 2 == 0) {
continue;
}
else {
if (flag) {
p = i;
}
else {
flag = false;
break;
}
}
}
if (flag) {
printf("%c\n", p + 'a' - 1);
}
else {
cout << "Impossible" << endl;
}
return 0;
}
yukiteru