結果
| 問題 |
No.2315 Flying Camera
|
| コンテスト | |
| ユーザー |
ks2m
|
| 提出日時 | 2023-05-26 21:23:19 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 320 ms / 2,000 ms |
| コード長 | 610 bytes |
| コンパイル時間 | 2,630 ms |
| コンパイル使用メモリ | 74,596 KB |
| 実行使用メモリ | 42,492 KB |
| 最終ジャッジ日時 | 2024-12-25 04:29:04 |
| 合計ジャッジ時間 | 9,238 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] x = new int[n];
int[] y = new int[n];
for (int i = 0; i < n; i++) {
x[i] = sc.nextInt();
y[i] = sc.nextInt();
}
sc.close();
int ans = Integer.MAX_VALUE;
for (int i = 0; i <= 300; i++) {
for (int j = 0; j <= 300; j++) {
int val = 0;
for (int k = 0; k < n; k++) {
val += Math.abs(i - x[k]);
val += Math.abs(j - y[k]);
}
ans = Math.min(ans, val);
}
}
System.out.println(ans);
}
}
ks2m