結果

問題 No.431 死亡フラグ
ユーザー DialBird
提出日時 2016-10-19 21:40:21
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 328 bytes
コンパイル時間 215 ms
コンパイル使用メモリ 23,552 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-22 17:02:03
合計ジャッジ時間 864 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:9: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |   fscanf(stdin, "%d%d%d%d", &flag[0], &flag[1], &flag[2], &flag[3]);
      |   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>

int main(void){
  int flag[4];
  int i;
  fscanf(stdin, "%d%d%d%d", &flag[0], &flag[1], &flag[2], &flag[3]);  
  int count = 0;
  for (i=0;i<3;i++) {
    if (flag[i] == 1) count++;
  }
  if (flag[3] == 1 || count < 2) {
    puts("SURVIVED");
  } else {
    puts("DEAD");
  }
  exit(0);
}
0