結果
問題 |
No.287 場合の数
|
ユーザー |
![]() |
提出日時 | 2021-11-11 08:43:25 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 57 ms / 5,000 ms |
コード長 | 1,543 bytes |
コンパイル時間 | 4,612 ms |
コンパイル使用メモリ | 76,624 KB |
実行使用メモリ | 37,168 KB |
最終ジャッジ日時 | 2024-11-22 08:30:28 |
合計ジャッジ時間 | 5,177 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); long[] counts2 = new long[2 * n + 1]; for (int i = 0; i <= n; i++) { for (int j = 0; j <= n; j++) { counts2[i + j]++; } } long[] counts4 = new long[4 * n + 1]; for (int i = 0; i <= 2 * n; i++) { for (int j = 0; j <= 2 * n; j++) { counts4[i + j] += counts2[i] * counts2[j]; } } long ans = 0; for (int i = 2 * n; i <= 4 * n; i++) { ans += counts4[i] * counts4[6 * n - i]; } System.out.println(ans); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public String nextLine() throws Exception { return br.readLine(); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }