結果

問題 No.657 テトラナッチ数列 Easy
ユーザー 37zigen
提出日時 2020-02-17 22:17:35
言語 Java
(openjdk 23)
結果
AC  
実行時間 397 ms / 2,000 ms
コード長 524 bytes
コンパイル時間 2,154 ms
コンパイル使用メモリ 74,596 KB
実行使用メモリ 51,376 KB
最終ジャッジ日時 2024-10-06 15:16:24
合計ジャッジ時間 7,629 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

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