結果
問題 |
No.118 門松列(2)
|
ユーザー |
![]() |
提出日時 | 2015-01-07 00:19:55 |
言語 | Java (openjdk 23) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 473 bytes |
コンパイル時間 | 2,231 ms |
コンパイル使用メモリ | 74,800 KB |
実行使用メモリ | 61,216 KB |
最終ジャッジ日時 | 2024-06-13 02:51:30 |
合計ジャッジ時間 | 13,444 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 WA * 1 |
ソースコード
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 += a[i] * a[i]; cb += a[i] * a[i] * a[i]; } long ans = (s * s * s - 3 * s * sq + 2 * cb) / 6; System.out.println(ans % 1000000007); } }