結果

問題 No.131 マンハッタン距離
ユーザー kou6839kou6839
提出日時 2015-02-22 23:23:19
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 382 bytes
コンパイル時間 4,052 ms
コンパイル使用メモリ 71,136 KB
実行使用メモリ 59,804 KB
最終ジャッジ日時 2023-09-06 03:01:41
合計ジャッジ時間 6,650 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
56,080 KB
testcase_01 AC 122 ms
55,964 KB
testcase_02 AC 122 ms
55,760 KB
testcase_03 AC 122 ms
55,848 KB
testcase_04 AC 122 ms
55,868 KB
testcase_05 AC 123 ms
55,536 KB
testcase_06 AC 123 ms
55,912 KB
testcase_07 WA -
testcase_08 AC 121 ms
55,532 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 121 ms
55,984 KB
testcase_14 AC 123 ms
55,864 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 122 ms
55,856 KB
testcase_18 AC 123 ms
55,508 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 125 ms
55,604 KB
testcase_24 AC 124 ms
54,252 KB
testcase_25 WA -
testcase_26 AC 123 ms
55,796 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