結果
| 問題 |
No.587 七対子
|
| コンテスト | |
| ユーザー |
AQUA16573837
|
| 提出日時 | 2018-04-05 00:39:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 619 bytes |
| コンパイル時間 | 454 ms |
| コンパイル使用メモリ | 58,700 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-19 19:51:59 |
| 合計ジャッジ時間 | 1,502 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 |
コンパイルメッセージ
main.cpp: In function ‘void solve()’:
main.cpp:21:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
21 | scanf("%s", s);
| ~~~~~^~~~~~~~~
ソースコード
#include <stdio.h>
#include <algorithm>
#include <deque>
#include <string>
#include <iostream>
using namespace std;
using ll = long long;
void solve();
int main() {
solve();
#ifdef DBG
while (true);
#endif
}
//587
void solve() {
char s[14], c[26] = { 0 };
int oc = 0, tc = 0;
scanf("%s", s);
for (int i = 0; i < 13; i++) {
c[s[i] - 'a']++;
if (c[s[i] - 'a'] == 1)
oc++;
else if (c[s[i] - 'a'] == 2)
oc--, tc++;
else if (3 <= c[s[i] - 'a'])
tc--;
}
if (oc == 1 && tc == 6) {
for (int i = 0; i < 26; i++)
if (c[i] == 1)
printf("%c\n", i + 'a');
} else {
printf("Impossible\n");
}
}
AQUA16573837