結果

問題 No.554 recurrence formula
ユーザー aaaaasatoriaaaaasatori
提出日時 2018-02-24 18:34:28
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 387 bytes
コンパイル時間 4,625 ms
コンパイル使用メモリ 74,096 KB
実行使用メモリ 61,644 KB
最終ジャッジ日時 2024-04-23 04:39:29
合計ジャッジ時間 10,120 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
61,348 KB
testcase_01 AC 130 ms
53,992 KB
testcase_02 AC 126 ms
53,036 KB
testcase_03 AC 131 ms
54,216 KB
testcase_04 AC 133 ms
54,140 KB
testcase_05 AC 133 ms
53,956 KB
testcase_06 AC 133 ms
54,052 KB
testcase_07 AC 133 ms
54,220 KB
testcase_08 AC 133 ms
54,096 KB
testcase_09 AC 117 ms
53,028 KB
testcase_10 AC 142 ms
54,208 KB
testcase_11 AC 151 ms
54,272 KB
testcase_12 AC 149 ms
54,044 KB
testcase_13 AC 173 ms
54,108 KB
testcase_14 AC 153 ms
54,324 KB
testcase_15 AC 182 ms
54,148 KB
testcase_16 AC 174 ms
53,096 KB
testcase_17 AC 164 ms
54,232 KB
testcase_18 AC 157 ms
54,032 KB
testcase_19 TLE -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No554 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final long mod = 1000000007;
		int n = sc.nextInt();
		long a[] = new long[n+1];
		a[0] = 0;
		a[1] = 1;
		for(int i = 2;i <= n;i++) {
			for(int j = 1;j < i;j += 2) {
				a[i] += i * a[i-j] % mod; 
			}
			a[i] %= mod;
		}
		System.out.println(a[n]);
	}
}
0