結果

問題 No.657 テトラナッチ数列 Easy
ユーザー 37zigen37zigen
提出日時 2020-02-17 22:17:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 390 ms / 2,000 ms
コード長 524 bytes
コンパイル時間 2,173 ms
コンパイル使用メモリ 74,892 KB
実行使用メモリ 63,664 KB
最終ジャッジ日時 2024-04-16 03:59:47
合計ジャッジ時間 7,108 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 146 ms
58,212 KB
testcase_01 AC 147 ms
58,188 KB
testcase_02 AC 146 ms
58,372 KB
testcase_03 AC 147 ms
58,412 KB
testcase_04 AC 148 ms
58,200 KB
testcase_05 AC 369 ms
63,032 KB
testcase_06 AC 148 ms
57,964 KB
testcase_07 AC 149 ms
58,272 KB
testcase_08 AC 146 ms
58,120 KB
testcase_09 AC 378 ms
62,976 KB
testcase_10 AC 380 ms
62,888 KB
testcase_11 AC 385 ms
63,192 KB
testcase_12 AC 376 ms
62,836 KB
testcase_13 AC 376 ms
63,236 KB
testcase_14 AC 379 ms
63,220 KB
testcase_15 AC 390 ms
63,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

class Main {
	public static void main(String[] args) throws Exception {
		new Main().run();
	}
	
	void run() {
		Scanner sc=new Scanner(System.in);
		int Q=sc.nextInt();
		int[] T=new int[(int)1e6+10];
		T[4]=1;
		for(int i=5;i<T.length;++i) {
			T[i]=(T[i-1]+T[i-2]+T[i-3]+T[i-4])%17;
		}
		for(int i=0;i<Q;++i) {
			int n=sc.nextInt();
			System.out.println(T[n]);
		}
	}
	
	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
	
}
0