結果

問題 No.131 マンハッタン距離
ユーザー hhgfhn1
提出日時 2018-11-21 20:56:31
言語 Java
(openjdk 23)
結果
TLE  
実行時間 -
コード長 413 bytes
コンパイル時間 3,139 ms
コンパイル使用メモリ 74,580 KB
実行使用メモリ 81,848 KB
最終ジャッジ日時 2024-12-24 16:05:00
合計ジャッジ時間 53,616 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 TLE * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int x=scanner.nextInt();
		int y=scanner.nextInt();
		int d=scanner.nextInt();
		long cnt=0;
		for(int i=0;i<=x;i++) {
			for(int j=0;j<=y;j++) {
				if(Math.abs(x-i)+Math.abs(y-j)==d) {
					cnt++;
				}
			}
		}
		System.out.println(cnt);
	}
}
0