結果

問題 No.548 国士無双
ユーザー ser
提出日時 2018-01-04 10:01:55
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 602 bytes
コンパイル時間 660 ms
コンパイル使用メモリ 66,080 KB
最終ジャッジ日時 2025-01-05 06:59:29
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         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);        
        if('a'<=s && s<='m') 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