結果

問題 No.131 マンハッタン距離
ユーザー rf141rf141
提出日時 2015-08-06 00:00:32
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 345 bytes
コンパイル時間 3,475 ms
コンパイル使用メモリ 74,808 KB
実行使用メモリ 54,400 KB
最終ジャッジ日時 2024-07-18 03:33:52
合計ジャッジ時間 7,830 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 132 ms
41,140 KB
testcase_02 AC 133 ms
41,012 KB
testcase_03 AC 133 ms
41,312 KB
testcase_04 AC 134 ms
41,280 KB
testcase_05 AC 132 ms
41,012 KB
testcase_06 AC 130 ms
41,228 KB
testcase_07 AC 136 ms
41,396 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 131 ms
41,356 KB
testcase_26 AC 132 ms
41,304 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