結果

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

ソースコード

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