結果

問題 No.131 マンハッタン距離
ユーザー kuramukuramu
提出日時 2016-02-03 00:13:35
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 772 bytes
コンパイル時間 2,325 ms
コンパイル使用メモリ 74,608 KB
実行使用メモリ 59,028 KB
最終ジャッジ日時 2023-10-21 18:47:21
合計ジャッジ時間 8,808 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
57,768 KB
testcase_01 AC 56 ms
53,420 KB
testcase_02 AC 55 ms
53,432 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

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 = 0;
	    	  int temp = 0;
	    	  if(x>y) temp=x;
	    	  else temp = y;
	    	  for(int i=0;i<=temp;i++){
	    		  for(int j=0;j<=temp;j++){
	    			  if(x>=i && y>= j && i+j==d) ans++;
	    		  }
	    	  }
	    	  System.out.println(ans);
	      } catch (IOException e) {
			e.printStackTrace();
	      }
	}
}
0