結果

問題 No.1041 直線大学
ユーザー xRS43BofaUEZ5gcxRS43BofaUEZ5gc
提出日時 2021-03-29 16:07:24
言語 Java21
(openjdk 21)
結果
AC  
実行時間 162 ms / 2,000 ms
コード長 892 bytes
コンパイル時間 3,312 ms
コンパイル使用メモリ 77,056 KB
実行使用メモリ 41,964 KB
最終ジャッジ日時 2024-04-28 00:18:37
合計ジャッジ時間 9,667 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
41,032 KB
testcase_01 AC 116 ms
41,260 KB
testcase_02 AC 124 ms
41,320 KB
testcase_03 AC 119 ms
40,756 KB
testcase_04 AC 113 ms
40,028 KB
testcase_05 AC 112 ms
39,956 KB
testcase_06 AC 110 ms
40,000 KB
testcase_07 AC 128 ms
41,276 KB
testcase_08 AC 135 ms
41,408 KB
testcase_09 AC 121 ms
40,268 KB
testcase_10 AC 152 ms
41,568 KB
testcase_11 AC 152 ms
41,964 KB
testcase_12 AC 155 ms
41,840 KB
testcase_13 AC 135 ms
41,276 KB
testcase_14 AC 162 ms
41,664 KB
testcase_15 AC 138 ms
41,444 KB
testcase_16 AC 152 ms
41,572 KB
testcase_17 AC 117 ms
40,220 KB
testcase_18 AC 143 ms
41,684 KB
testcase_19 AC 147 ms
41,704 KB
testcase_20 AC 117 ms
40,136 KB
testcase_21 AC 141 ms
41,436 KB
testcase_22 AC 114 ms
40,168 KB
testcase_23 AC 147 ms
41,216 KB
testcase_24 AC 151 ms
41,468 KB
testcase_25 AC 145 ms
41,496 KB
testcase_26 AC 130 ms
41,200 KB
testcase_27 AC 136 ms
41,536 KB
testcase_28 AC 115 ms
40,176 KB
testcase_29 AC 111 ms
40,036 KB
testcase_30 AC 112 ms
39,860 KB
testcase_31 AC 114 ms
40,188 KB
testcase_32 AC 112 ms
39,900 KB
testcase_33 AC 126 ms
41,152 KB
testcase_34 AC 126 ms
41,632 KB
testcase_35 AC 124 ms
41,288 KB
testcase_36 AC 124 ms
41,288 KB
testcase_37 AC 124 ms
41,544 KB
testcase_38 AC 152 ms
41,580 KB
testcase_39 AC 134 ms
41,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class HelloWorld {
		public static void main (String[] args) {
			Scanner sc = new Scanner(System.in);
			int n = sc.nextInt();
			int[][] positions = new int[n][2];
			for (int i = 0; i < n; i ++) {
				positions[i][0] = sc.nextInt();
				positions[i][1] = sc.nextInt();
			}

			int count = 1;

			for (int i = 0; i < n; i ++) {
				for (int j = i+1; j < n; j ++) {
					long deltax1 = positions[i][0] - positions[j][0];
					long deltay1 = positions[i][1] - positions[j][1];
					int count_temp = 0;
					for (int ni = 0; ni < n; ni ++) {
						long deltax2 = positions[ni][0] - positions[j][0];
						long deltay2 = positions[ni][1] - positions[j][1];
						if (deltax1 * deltay2 == deltax2 * deltay1) {
							count_temp ++;
						}
					}
					if (count_temp > count) {
						count = count_temp;
					}
				}
			}
			
			System.out.println(count);
	}
}
0