結果

問題 No.131 マンハッタン距離
ユーザー kuramukuramu
提出日時 2016-02-03 00:23:04
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 732 bytes
コンパイル時間 2,428 ms
コンパイル使用メモリ 74,364 KB
実行使用メモリ 53,548 KB
最終ジャッジ日時 2023-10-21 18:47:26
合計ジャッジ時間 4,727 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
53,544 KB
testcase_01 AC 51 ms
53,540 KB
testcase_02 AC 55 ms
53,536 KB
testcase_03 AC 52 ms
53,548 KB
testcase_04 AC 52 ms
53,476 KB
testcase_05 AC 53 ms
53,540 KB
testcase_06 AC 53 ms
53,536 KB
testcase_07 AC 54 ms
53,536 KB
testcase_08 AC 54 ms
53,540 KB
testcase_09 AC 55 ms
53,540 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 54 ms
53,536 KB
testcase_14 AC 54 ms
53,536 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 53 ms
53,544 KB
testcase_18 AC 53 ms
52,452 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 54 ms
53,532 KB
testcase_23 AC 54 ms
53,540 KB
testcase_24 AC 55 ms
53,544 KB
testcase_25 WA -
testcase_26 AC 53 ms
53,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {

	 public static void main(String[] args) {
	      BufferedReader stdReader =new BufferedReader(new InputStreamReader(System.in));
	      try {
	    	  String[] line = stdReader.readLine().split(" ");
	    	  int x = Integer.parseInt(line[0]);
	    	  int y = Integer.parseInt(line[1]);
	    	  int d = Integer.parseInt(line[2]);
	    	  int ans = d+1;
	    	  if(x+y<d){
	    		  ans = 0;
	    	  }else{
	    		  if(d>x){
	    			  ans = d-x;
	    		  }
	    		  if(d>y){
	    			  ans = d-y;
	    		  }
	    	  }
	    	  System.out.println(ans);
	      } catch (IOException e) {
			e.printStackTrace();
	      }
	}
}
0