結果

問題 No.1041 直線大学
ユーザー ks2mks2m
提出日時 2020-05-01 21:26:21
言語 Java21
(openjdk 21)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 693 bytes
コンパイル時間 1,694 ms
コンパイル使用メモリ 77,092 KB
実行使用メモリ 41,844 KB
最終ジャッジ日時 2024-04-28 00:10:15
合計ジャッジ時間 7,123 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
40,376 KB
testcase_01 AC 107 ms
40,792 KB
testcase_02 AC 104 ms
40,012 KB
testcase_03 AC 112 ms
41,148 KB
testcase_04 AC 114 ms
40,920 KB
testcase_05 AC 106 ms
40,876 KB
testcase_06 AC 105 ms
41,280 KB
testcase_07 AC 110 ms
40,980 KB
testcase_08 AC 114 ms
41,168 KB
testcase_09 AC 112 ms
41,152 KB
testcase_10 AC 131 ms
41,692 KB
testcase_11 AC 119 ms
40,972 KB
testcase_12 AC 133 ms
41,444 KB
testcase_13 AC 117 ms
41,328 KB
testcase_14 AC 124 ms
41,716 KB
testcase_15 AC 112 ms
41,048 KB
testcase_16 AC 115 ms
41,120 KB
testcase_17 AC 108 ms
40,984 KB
testcase_18 AC 116 ms
41,404 KB
testcase_19 AC 116 ms
41,112 KB
testcase_20 AC 114 ms
41,148 KB
testcase_21 AC 119 ms
41,188 KB
testcase_22 AC 93 ms
39,708 KB
testcase_23 AC 126 ms
41,536 KB
testcase_24 AC 119 ms
41,048 KB
testcase_25 AC 115 ms
41,504 KB
testcase_26 AC 100 ms
40,544 KB
testcase_27 AC 119 ms
41,464 KB
testcase_28 AC 105 ms
40,500 KB
testcase_29 AC 96 ms
40,124 KB
testcase_30 AC 95 ms
39,960 KB
testcase_31 AC 107 ms
40,984 KB
testcase_32 AC 97 ms
39,912 KB
testcase_33 AC 118 ms
41,468 KB
testcase_34 AC 106 ms
41,364 KB
testcase_35 AC 107 ms
41,112 KB
testcase_36 AC 97 ms
39,960 KB
testcase_37 AC 108 ms
41,492 KB
testcase_38 AC 128 ms
41,844 KB
testcase_39 AC 106 ms
41,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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);
	}
}
0