結果

問題 No.131 マンハッタン距離
ユーザー rf141rf141
提出日時 2015-08-06 00:00:32
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 345 bytes
コンパイル時間 3,551 ms
コンパイル使用メモリ 71,444 KB
実行使用メモリ 57,792 KB
最終ジャッジ日時 2023-09-25 04:04:02
合計ジャッジ時間 8,170 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 126 ms
53,948 KB
testcase_02 AC 128 ms
55,976 KB
testcase_03 AC 129 ms
55,920 KB
testcase_04 AC 130 ms
56,308 KB
testcase_05 AC 126 ms
55,844 KB
testcase_06 AC 126 ms
55,824 KB
testcase_07 AC 125 ms
55,936 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 129 ms
55,856 KB
testcase_26 AC 128 ms
55,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Distance{
	public static void main(String... args){
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int y = scan.nextInt();
		int d = scan.nextInt();
		if(x+y<d){
			System.out.println(0);
			return;
		}
		int dx = (d <= x)? d:x;
		int dy = (d <= y)? d:y;
		System.out.println(1+dx-dy);
	}
}
0