結果

問題 No.1041 直線大学
ユーザー htensaihtensai
提出日時 2020-05-07 10:02:23
言語 Java21
(openjdk 21)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 798 bytes
コンパイル時間 1,666 ms
コンパイル使用メモリ 76,744 KB
実行使用メモリ 41,784 KB
最終ジャッジ日時 2024-04-28 00:15:27
合計ジャッジ時間 7,040 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
40,424 KB
testcase_01 AC 107 ms
41,096 KB
testcase_02 AC 103 ms
40,992 KB
testcase_03 AC 100 ms
40,056 KB
testcase_04 AC 110 ms
41,192 KB
testcase_05 AC 105 ms
40,888 KB
testcase_06 AC 107 ms
41,160 KB
testcase_07 AC 98 ms
40,088 KB
testcase_08 AC 111 ms
41,188 KB
testcase_09 AC 116 ms
41,140 KB
testcase_10 AC 129 ms
41,304 KB
testcase_11 AC 130 ms
41,536 KB
testcase_12 AC 127 ms
41,308 KB
testcase_13 AC 115 ms
40,988 KB
testcase_14 AC 117 ms
41,384 KB
testcase_15 AC 118 ms
41,576 KB
testcase_16 AC 117 ms
41,784 KB
testcase_17 AC 106 ms
41,156 KB
testcase_18 AC 115 ms
41,512 KB
testcase_19 AC 119 ms
41,556 KB
testcase_20 AC 106 ms
40,972 KB
testcase_21 AC 115 ms
41,236 KB
testcase_22 AC 109 ms
40,916 KB
testcase_23 AC 123 ms
41,188 KB
testcase_24 AC 111 ms
40,884 KB
testcase_25 AC 113 ms
41,036 KB
testcase_26 AC 100 ms
40,384 KB
testcase_27 AC 121 ms
41,576 KB
testcase_28 AC 104 ms
40,900 KB
testcase_29 AC 102 ms
40,888 KB
testcase_30 AC 105 ms
40,980 KB
testcase_31 AC 96 ms
40,252 KB
testcase_32 AC 103 ms
41,044 KB
testcase_33 AC 94 ms
39,704 KB
testcase_34 AC 104 ms
40,964 KB
testcase_35 AC 99 ms
39,912 KB
testcase_36 AC 101 ms
39,896 KB
testcase_37 AC 109 ms
41,068 KB
testcase_38 AC 137 ms
41,560 KB
testcase_39 AC 112 ms
41,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arrX = new int[n];
		int[] arrY = new int[n];
		for (int i = 0; i < n; i++) {
		    arrX[i] = sc.nextInt();
		    arrY[i] = sc.nextInt();
		}
		int max = 2;
		for (int i = 0; i < n - 2; i++) {
		    for (int j = i + 1; j < n - 1; j++) {
		        int x = arrX[i] - arrX[j];
		        int y = arrY[i] - arrY[j];
		        int count = 0;
		        for (int k = j + 1; k < n; k++) {
    		        int xx = arrX[i] - arrX[k];
    		        int yy = arrY[i] - arrY[k];
    		        if (x * yy == y * xx) {
    		            count++;
    		        }
		        }
		        max = Math.max(max, count + 2);
		    }
		}
		System.out.println(max);
	}
}
0