結果

問題 No.131 マンハッタン距離
ユーザー rf141rf141
提出日時 2015-08-06 00:01:14
言語 Java19
(openjdk 21)
結果
AC  
実行時間 128 ms / 5,000 ms
コード長 411 bytes
コンパイル時間 3,160 ms
コンパイル使用メモリ 71,544 KB
実行使用メモリ 56,488 KB
最終ジャッジ日時 2023-09-25 04:04:21
合計ジャッジ時間 7,747 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
54,096 KB
testcase_01 AC 125 ms
55,652 KB
testcase_02 AC 126 ms
55,808 KB
testcase_03 AC 124 ms
55,888 KB
testcase_04 AC 123 ms
55,696 KB
testcase_05 AC 122 ms
55,904 KB
testcase_06 AC 123 ms
55,456 KB
testcase_07 AC 122 ms
55,828 KB
testcase_08 AC 123 ms
55,816 KB
testcase_09 AC 124 ms
56,028 KB
testcase_10 AC 125 ms
55,840 KB
testcase_11 AC 124 ms
55,844 KB
testcase_12 AC 125 ms
55,500 KB
testcase_13 AC 123 ms
55,972 KB
testcase_14 AC 125 ms
55,808 KB
testcase_15 AC 128 ms
56,372 KB
testcase_16 AC 125 ms
53,680 KB
testcase_17 AC 122 ms
55,860 KB
testcase_18 AC 126 ms
55,792 KB
testcase_19 AC 124 ms
55,804 KB
testcase_20 AC 125 ms
56,488 KB
testcase_21 AC 123 ms
55,976 KB
testcase_22 AC 124 ms
56,064 KB
testcase_23 AC 126 ms
55,524 KB
testcase_24 AC 124 ms
55,852 KB
testcase_25 AC 125 ms
55,860 KB
testcase_26 AC 123 ms
55,956 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();
        int count=d+1;
        if(x < d)count -= d - x;
        if(y < d)count -= d - y;
        if(x+y<d){System.out.println(0);return;}
        System.out.println(count);
    }
}
0