結果

問題 No.1041 直線大学
ユーザー tentententen
提出日時 2020-08-20 20:52:37
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 863 bytes
コンパイル時間 1,760 ms
コンパイル使用メモリ 74,216 KB
実行使用メモリ 41,892 KB
最終ジャッジ日時 2024-04-21 19:16:19
合計ジャッジ時間 7,431 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
41,064 KB
testcase_01 AC 105 ms
41,356 KB
testcase_02 AC 102 ms
40,160 KB
testcase_03 AC 108 ms
41,080 KB
testcase_04 WA -
testcase_05 AC 111 ms
41,168 KB
testcase_06 AC 113 ms
41,236 KB
testcase_07 AC 106 ms
40,200 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 128 ms
41,396 KB
testcase_11 AC 128 ms
41,892 KB
testcase_12 AC 132 ms
41,260 KB
testcase_13 AC 119 ms
40,896 KB
testcase_14 AC 127 ms
41,232 KB
testcase_15 AC 121 ms
41,260 KB
testcase_16 AC 126 ms
41,708 KB
testcase_17 AC 115 ms
41,048 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 113 ms
41,268 KB
testcase_21 WA -
testcase_22 AC 101 ms
40,216 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 120 ms
41,576 KB
testcase_28 AC 108 ms
40,432 KB
testcase_29 AC 100 ms
40,052 KB
testcase_30 AC 101 ms
39,960 KB
testcase_31 AC 113 ms
41,168 KB
testcase_32 AC 108 ms
41,276 KB
testcase_33 AC 111 ms
41,276 KB
testcase_34 AC 100 ms
40,160 KB
testcase_35 AC 114 ms
41,212 KB
testcase_36 AC 104 ms
40,072 KB
testcase_37 AC 112 ms
41,456 KB
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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