結果

問題 No.131 マンハッタン距離
ユーザー kou6839kou6839
提出日時 2015-02-22 23:27:11
言語 Java21
(openjdk 21)
結果
AC  
実行時間 134 ms / 5,000 ms
コード長 382 bytes
コンパイル時間 3,080 ms
コンパイル使用メモリ 71,764 KB
実行使用メモリ 57,684 KB
最終ジャッジ日時 2023-09-06 03:02:10
合計ジャッジ時間 8,551 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
55,804 KB
testcase_01 AC 130 ms
55,808 KB
testcase_02 AC 129 ms
55,908 KB
testcase_03 AC 129 ms
55,972 KB
testcase_04 AC 131 ms
57,684 KB
testcase_05 AC 130 ms
55,804 KB
testcase_06 AC 128 ms
55,572 KB
testcase_07 AC 134 ms
55,800 KB
testcase_08 AC 130 ms
55,520 KB
testcase_09 AC 129 ms
55,916 KB
testcase_10 AC 130 ms
55,800 KB
testcase_11 AC 133 ms
55,908 KB
testcase_12 AC 132 ms
55,536 KB
testcase_13 AC 129 ms
55,484 KB
testcase_14 AC 131 ms
53,748 KB
testcase_15 AC 130 ms
55,536 KB
testcase_16 AC 133 ms
55,748 KB
testcase_17 AC 132 ms
55,908 KB
testcase_18 AC 133 ms
55,804 KB
testcase_19 AC 129 ms
55,804 KB
testcase_20 AC 131 ms
55,676 KB
testcase_21 AC 132 ms
55,948 KB
testcase_22 AC 130 ms
55,944 KB
testcase_23 AC 130 ms
55,488 KB
testcase_24 AC 128 ms
55,908 KB
testcase_25 AC 129 ms
55,812 KB
testcase_26 AC 131 ms
55,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.*;
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y=sc.nextInt();
		int d = sc.nextInt();
		
		if(x+y<d){
			System.out.println(0);
			
		}else if(x>=d && y>=d){
			System.out.println(d+1);
		}else{
			System.out.println(d+1-Math.max(0,d-x)-Math.max(0,d-y));
		}
	}
}
0