結果

問題 No.281 門松と魔法(1)
ユーザー 184184
提出日時 2015-09-18 23:19:06
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 620 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 34,688 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 11:38:04
合計ジャッジ時間 1,551 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1 ms
5,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 0 ms
5,376 KB
testcase_15 WA -
testcase_16 AC 0 ms
5,376 KB
testcase_17 WA -
testcase_18 AC 1 ms
5,376 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 0 ms
5,376 KB
testcase_23 WA -
testcase_24 AC 0 ms
5,376 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 0 ms
5,376 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 1 ms
5,376 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 0 ms
5,376 KB
testcase_38 AC 1 ms
5,376 KB
testcase_39 WA -
testcase_40 AC 0 ms
5,376 KB
testcase_41 AC 1 ms
5,376 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:29: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         int d;int h[3];scanf("%d",&d);for(int i=0;i<3;i++)scanf("%d",&h[i]);
      |                        ~~~~~^~~~~~~~~
main.cpp:9:64: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         int d;int h[3];scanf("%d",&d);for(int i=0;i<3;i++)scanf("%d",&h[i]);
      |                                                           ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

//namaega184

int main(){
	int d;int h[3];scanf("%d",&d);for(int i=0;i<3;i++)scanf("%d",&h[i]);
	bool f[3];
	f[0]=h[0]!=h[1],f[1]=h[1]!=h[2],f[2]=h[2]!=h[0];
	if(f[0]&&f[1]&&f[2])puts("0");
	else if(!f[0]&&!f[1]&&!f[0]){
		if(h[0]>=d*2)puts("2");
		else puts("-1");
		return 0;
	}
	else{
		for(int i=0;i<3;i++){ 
			if(!f[i]){
				if(h[i]>=d){
					if(h[i]-d==h[(i+2)%3]){
						if(h[i]>=d*2)puts("2");
						else puts("-1");
						return 0;
					}
					else puts("1");
					return 0;
				}
			}
		}
	}
	//printf("%d\n",-1000);
	return 0;
}
0