結果
| 問題 |
No.1041 直線大学
|
| コンテスト | |
| ユーザー |
ks2m
|
| 提出日時 | 2020-05-01 21:26:21 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 165 ms / 2,000 ms |
| コード長 | 693 bytes |
| コンパイル時間 | 2,186 ms |
| コンパイル使用メモリ | 77,504 KB |
| 実行使用メモリ | 41,632 KB |
| 最終ジャッジ日時 | 2024-11-16 07:44:20 |
| 合計ジャッジ時間 | 8,919 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
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 = 0;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
int dx = x[j] - x[i];
int dy = y[j] - y[i];
int cnt = 2;
for (int k = j + 1; k < n; k++) {
int dx2 = x[k] - x[i];
int dy2 = y[k] - y[i];
if (dx * dy2 == dy * dx2) {
cnt++;
}
}
ans = Math.max(ans, cnt);
}
}
System.out.println(ans);
}
}
ks2m