結果

問題 No.431 死亡フラグ
ユーザー sasa
提出日時 2025-03-17 13:04:58
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 323 bytes
コンパイル時間 480 ms
コンパイル使用メモリ 27,520 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-17 13:05:00
合計ジャッジ時間 1,438 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |                 scanf("%d",&deadflg);
      |                 ~~~~~^~~~~~~~~~~~~~~
main.cpp:13:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |         scanf("%d",&surviveflg);
      |         ~~~~~^~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){
	int deadflg = 0;
	int count = 0;
	for(int i = 0;i < 3;i ++){
		scanf("%d",&deadflg);
		if(deadflg == 1){
			count++;
		}
	}
	int surviveflg = 0;
	scanf("%d",&surviveflg);
	if(surviveflg == 1){
		printf("SURVIVED");
	}else if(count >= 2){
		printf("DEAD");
	}else{
		printf("SURVIVED");
	}
}
0