結果
| 問題 | No.131 マンハッタン距離 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-05-26 03:24:39 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 59 ms / 5,000 ms |
| コード長 | 412 bytes |
| 記録 | |
| コンパイル時間 | 2,525 ms |
| コンパイル使用メモリ | 82,164 KB |
| 実行使用メモリ | 46,404 KB |
| 最終ジャッジ日時 | 2026-03-27 20:18:46 |
| 合計ジャッジ時間 | 5,231 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
import java.util.*;
public class Distance {
public static void main(String[] arg){
Scanner sc = new Scanner(System.in);
int x,y,d,res,temp;
x = sc.nextInt();
y = sc.nextInt();
d = sc.nextInt();
if(d<x){
if(d<y){
res = d+1;
}else{
res = y + 1;
}
}else{
if(d<y){
res = x + 1;
}else{
res = x + y + 1 - d;
if(res < 0)res = 0;
}
}
System.out.println(res);
}
}