結果
問題 | No.548 国士無双 |
ユーザー |
![]() |
提出日時 | 2018-04-05 01:00:36 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 710 bytes |
コンパイル時間 | 402 ms |
コンパイル使用メモリ | 59,296 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-17 14:47:34 |
合計ジャッジ時間 | 1,044 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 |
コンパイルメッセージ
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 DBGwhile (true);#endif}//548void solve() {char s[14], c[13] = { 0 };int oc = 0, tc = 0;scanf("%s", s);for (int i = 0; i < 13; i++) {if ('m' < s[i])break;c[s[i] - 'a']++;if (c[s[i] - 'a'] == 1)oc++;else if (c[s[i] - 'a'] == 2)oc--, tc++;elsetc--;}if (oc == 13) {for (int i = 0; i < 13; i++)printf("%c\n", 'a' + i);} else if (tc == 1 && oc == 11) {for (int i = 0; i < 13; i++)if (c[i] == 0)printf("%c\n", 'a' + i);} else {printf("Impossible\n");}}