結果
| 問題 |
No.431 死亡フラグ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-07-04 09:29:14 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 722 bytes |
| コンパイル時間 | 1,033 ms |
| コンパイル使用メモリ | 157,460 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-05 14:40:37 |
| 合計ジャッジ時間 | 1,622 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 |
コンパイルメッセージ
main.cpp: In function ‘int main(int, char**)’:
main.cpp:16:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
16 | scanf("%d %d %d %d",&D1,&D2,&D3,&S); //フラグの入力
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv)
{
int D1,D2,D3; //死亡フラグ
int S; //生存フラグ
//初期化
D1 = 0;
D2 = 0;
D3 = 0;
S = 0;
scanf("%d %d %d %d",&D1,&D2,&D3,&S); //フラグの入力
if(1 == S) //生存フラグ ON
{
printf("SURVIVED\n");
}
else if((0 == S) && (1 == D1) && (1 == D2) || (1 == D1) && (1 == D3) || (1 == D2) && (1 == D3)) //死亡フラグが2以上
{
printf("DEAD\n");
}
else if((0 == D1) && (1 == D2) || (0 == D1) && (1 == D3) || (1 == D1) || (0 == D2) || (1 == D1) && (0 == D3) || (0 == D2) || (1 == D3) || (1 == D2) || (0 == D3)) //死亡フラグ2以下
{
printf("SURVIVED\n");
}
return 0;
}