結果
| 問題 |
No.118 門松列(2)
|
| ユーザー |
ぴろず
|
| 提出日時 | 2016-02-18 15:44:11 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 585 ms / 5,000 ms |
| コード長 | 487 bytes |
| コンパイル時間 | 3,384 ms |
| コンパイル使用メモリ | 73,744 KB |
| 実行使用メモリ | 47,984 KB |
| 最終ジャッジ日時 | 2024-10-09 07:54:27 |
| 合計ジャッジ時間 | 13,926 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 26 |
ソースコード
package no118a;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] a = new int[100];
for(int i=0;i<n;i++) {
a[sc.nextInt()-1]++;
}
long s = n;
long sq = 0;
long cb = 0;
for(int i=0;i<100;i++) {
sq += (long) a[i] * a[i];
cb += (long) a[i] * a[i] * a[i];
}
long ans = (s * s * s - 3 * s * sq + 2 * cb) / 6;
System.out.println(ans % 1000000007);
}
}
ぴろず