結果

問題 No.1144 Triangles
ユーザー lavoxlavox
提出日時 2021-06-11 21:22:31
言語 Java21
(openjdk 21)
結果
AC  
実行時間 2,079 ms / 3,000 ms
コード長 660 bytes
コンパイル時間 2,352 ms
コンパイル使用メモリ 77,884 KB
実行使用メモリ 44,988 KB
最終ジャッジ日時 2024-05-08 16:41:47
合計ジャッジ時間 32,439 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
41,472 KB
testcase_01 AC 126 ms
41,128 KB
testcase_02 AC 124 ms
41,160 KB
testcase_03 AC 125 ms
41,224 KB
testcase_04 AC 2,079 ms
44,720 KB
testcase_05 AC 2,077 ms
44,896 KB
testcase_06 AC 2,075 ms
44,924 KB
testcase_07 AC 2,074 ms
44,584 KB
testcase_08 AC 2,077 ms
44,988 KB
testcase_09 AC 127 ms
41,184 KB
testcase_10 AC 125 ms
41,300 KB
testcase_11 AC 125 ms
41,472 KB
testcase_12 AC 125 ms
41,264 KB
testcase_13 AC 127 ms
41,184 KB
testcase_14 AC 1,870 ms
44,740 KB
testcase_15 AC 1,833 ms
44,592 KB
testcase_16 AC 1,987 ms
44,804 KB
testcase_17 AC 1,995 ms
44,816 KB
testcase_18 AC 1,994 ms
44,920 KB
testcase_19 AC 322 ms
43,972 KB
testcase_20 AC 170 ms
41,568 KB
testcase_21 AC 168 ms
41,836 KB
testcase_22 AC 1,907 ms
44,692 KB
testcase_23 AC 239 ms
42,168 KB
testcase_24 AC 1,866 ms
44,672 KB
testcase_25 AC 606 ms
44,252 KB
testcase_26 AC 222 ms
42,016 KB
testcase_27 AC 1,907 ms
44,724 KB
testcase_28 AC 396 ms
42,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	static final int MOD = 1000000007;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		long[] x = new long[n];
		long[] y = new long[n];
		for ( int i = 0 ; i < n ; i++ ) {
			x[i] = Long.parseLong(sc.next());
			y[i] = Long.parseLong(sc.next());
		}
		sc.close();
		
		long ans = 0;
		for ( int i = 0 ; i < n ; i++ ) {
			for ( int j = i + 1 ; j < n ; j++ ) {
				for ( int k = j + 1 ; k < n ; k++ ) {
					ans += Math.abs((x[k] - x[i]) * (y[j] - y[i]) - (y[k] - y[i]) * (x[j] - x[i]));
				}
			}
		}

		System.out.println(ans % MOD);
	}
}
0