結果

問題 No.431 死亡フラグ
ユーザー funakoshi
提出日時 2019-08-20 14:38:07
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 673 bytes
コンパイル時間 458 ms
コンパイル使用メモリ 29,440 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-06 12:18:00
合計ジャッジ時間 1,139 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
int main(void)
{
    int sf,dfcnt=0;
    int df[3]={0};
    bool flg=true;
    for(int i=0;i<3;i++)
    {
        scanf("%d",&df[i]);
    }
    scanf("%d",&sf);
    if(sf==1)
    {
        printf("SURVIVED");
    }
    else
    {
        for(int i=0;i<3;i++)
        {
            if(df[i]==1)
            {
                dfcnt++;
            }
            if(dfcnt>=2)
            {
                flg=false;
            }
        }
        if(flg==true)
        {
            printf("SURVIVED");
        }
        else
        {
            printf("DEAD");
        }
        
    }
    
}
0