結果

問題 No.657 テトラナッチ数列 Easy
ユーザー GrenacheGrenache
提出日時 2018-03-04 00:22:07
言語 Java21
(openjdk 21)
結果
AC  
実行時間 328 ms / 2,000 ms
コード長 800 bytes
コンパイル時間 4,553 ms
コンパイル使用メモリ 72,084 KB
実行使用メモリ 66,180 KB
最終ジャッジ日時 2023-09-18 14:15:03
合計ジャッジ時間 8,959 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 143 ms
59,992 KB
testcase_01 AC 146 ms
59,676 KB
testcase_02 AC 145 ms
59,632 KB
testcase_03 AC 144 ms
59,708 KB
testcase_04 AC 145 ms
59,908 KB
testcase_05 AC 298 ms
64,708 KB
testcase_06 AC 146 ms
59,556 KB
testcase_07 AC 148 ms
58,016 KB
testcase_08 AC 144 ms
59,776 KB
testcase_09 AC 317 ms
64,236 KB
testcase_10 AC 314 ms
64,768 KB
testcase_11 AC 316 ms
64,552 KB
testcase_12 AC 320 ms
64,244 KB
testcase_13 AC 328 ms
64,876 KB
testcase_14 AC 323 ms
64,764 KB
testcase_15 AC 325 ms
66,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main_yukicoder657 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int q = sc.nextInt();

		int[] n = new int[q];
		for (int i = 0; i < q; i++) {
			n[i] = sc.nextInt();
		}

		int[] t = new int[1_000_000];
		t[3] = 1;
		for (int i = 4; i < 1_000_000; i++) {
			t[i] = (t[i - 1] + t[i - 2] + t[i - 3] + t[i - 4]) % 17;
		}

		for (int i = 0; i < q; i++) {
			pr.println(t[n[i] - 1]);
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0