結果

問題 No.131 マンハッタン距離
ユーザー chiho_miyakochiho_miyako
提出日時 2015-04-06 10:54:11
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 740 bytes
コンパイル時間 2,441 ms
コンパイル使用メモリ 71,060 KB
実行使用メモリ 58,052 KB
最終ジャッジ日時 2023-09-17 06:10:30
合計ジャッジ時間 5,590 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
55,792 KB
testcase_01 AC 104 ms
55,884 KB
testcase_02 AC 107 ms
55,524 KB
testcase_03 AC 107 ms
55,264 KB
testcase_04 AC 105 ms
55,708 KB
testcase_05 AC 111 ms
55,976 KB
testcase_06 AC 107 ms
55,888 KB
testcase_07 AC 101 ms
56,108 KB
testcase_08 AC 105 ms
56,208 KB
testcase_09 AC 103 ms
55,864 KB
testcase_10 AC 104 ms
55,436 KB
testcase_11 AC 104 ms
55,732 KB
testcase_12 WA -
testcase_13 AC 107 ms
55,748 KB
testcase_14 AC 103 ms
58,052 KB
testcase_15 AC 100 ms
55,944 KB
testcase_16 AC 102 ms
55,664 KB
testcase_17 AC 100 ms
55,600 KB
testcase_18 AC 103 ms
55,520 KB
testcase_19 AC 101 ms
56,248 KB
testcase_20 AC 101 ms
55,772 KB
testcase_21 AC 106 ms
55,968 KB
testcase_22 AC 101 ms
56,024 KB
testcase_23 AC 101 ms
56,112 KB
testcase_24 AC 100 ms
55,660 KB
testcase_25 AC 103 ms
55,796 KB
testcase_26 AC 105 ms
55,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

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