結果

問題 No.657 テトラナッチ数列 Easy
ユーザー jp_stejp_ste
提出日時 2018-06-03 03:37:11
言語 Java21
(openjdk 21)
結果
AC  
実行時間 389 ms / 2,000 ms
コード長 410 bytes
コンパイル時間 1,957 ms
コンパイル使用メモリ 70,900 KB
実行使用メモリ 67,024 KB
最終ジャッジ日時 2023-09-12 21:42:42
合計ジャッジ時間 7,233 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 148 ms
61,756 KB
testcase_01 AC 147 ms
61,616 KB
testcase_02 AC 149 ms
62,088 KB
testcase_03 AC 148 ms
62,132 KB
testcase_04 AC 144 ms
61,528 KB
testcase_05 AC 348 ms
65,508 KB
testcase_06 AC 148 ms
61,816 KB
testcase_07 AC 152 ms
62,036 KB
testcase_08 AC 147 ms
61,748 KB
testcase_09 AC 371 ms
65,996 KB
testcase_10 AC 372 ms
66,628 KB
testcase_11 AC 367 ms
66,820 KB
testcase_12 AC 375 ms
66,816 KB
testcase_13 AC 381 ms
67,024 KB
testcase_14 AC 373 ms
66,816 KB
testcase_15 AC 389 ms
67,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		
		long dp[] = new long[1000001];
		dp[4] = 1;
		for(int i=5; i<1000001; i++) {
			dp[i] = (dp[i-1] + dp[i-2] + dp[i-3] + dp[i-4]) % 17;
		}
		
		try (Scanner scan = new Scanner(System.in)) {
			int q = scan.nextInt();
			for(int i=0; i<q; i++) {
				int n = scan.nextInt();
				System.out.println(dp[n]);
			}
		}
	}
}
0