結果

問題 No.548 国士無双
ユーザー ser
提出日時 2017-08-19 18:10:57
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 574 bytes
コンパイル時間 352 ms
コンパイル使用メモリ 54,392 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-17 13:43:54
合計ジャッジ時間 1,095 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         scanf("%c", &s);
      |         ~~~~~^~~~~~~~~~

ソースコード

diff #

#include <cstdio>
#include <iostream>

using namespace std;

int main() {

    int h[13] = {};
    for(int i=0; i<13; i++) {
        char s;
        scanf("%c", &s);
        h[s-'a']++;
    }

    bool impossible=true;
    for(int i=0; i<13; i++) {
        bool ok = true;
        for(int j=0; j<13; j++) {
            if(j!=i && h[j]==0) {
                ok = false;
                break;
            }
        }
        if(ok) {
            printf("%c\n", i+'a');
            impossible=false;
        }
    }

    if(impossible) {
        printf("Impossible");
    }
}
0