結果

問題 No.208 王将
ユーザー TLwiegehttTLwiegehtt
提出日時 2015-07-12 01:44:23
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 514 bytes
コンパイル時間 977 ms
コンパイル使用メモリ 23,316 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-22 14:11:49
合計ジャッジ時間 1,615 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 0 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 0 ms
4,376 KB
testcase_08 WA -
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 0 ms
4,380 KB
testcase_12 WA -
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 0 ms
4,376 KB
testcase_20 AC 0 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 0 ms
4,380 KB
testcase_23 AC 0 ms
4,376 KB
testcase_24 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int abs(int n){
	if(n<0){
		return -1*n;
	}
	return n;
}

int getSymbol(int n){
	if(n<0){
		return -1;
	}else if(n>0){
		return 1;
	}else{
		return 0;
	}
}

int main(void){
	int ex, ey;
	int tx, ty;
	int dis;
	
	
	scanf("%d %d", &tx, &ty);
	scanf("%d %d", &ex, &ey);
	
	if(abs(tx) > abs(ty)){
		dis = abs(tx);
	}else{
		dis = abs(ty);
	}
	
	if(getSymbol(ex) == getSymbol(tx) && getSymbol(ey) == getSymbol(ty)){
		if(abs(tx) > abs(ex)){
			dis += 1;
		}
	}
	
	printf("%d\n", dis);
	
	return 0;
}
0