結果

問題 No.131 マンハッタン距離
ユーザー kuramu
提出日時 2016-02-03 00:23:04
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 732 bytes
コンパイル時間 1,814 ms
コンパイル使用メモリ 73,112 KB
実行使用メモリ 42,328 KB
最終ジャッジ日時 2024-09-21 20:06:20
合計ジャッジ時間 3,907 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 9
権限があれば一括ダウンロードができます

ソースコード

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