結果
問題 | No.657 テトラナッチ数列 Easy |
ユーザー |
|
提出日時 | 2018-03-04 00:22:07 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 326 ms / 2,000 ms |
コード長 | 800 bytes |
コンパイル時間 | 3,552 ms |
コンパイル使用メモリ | 74,932 KB |
実行使用メモリ | 51,936 KB |
最終ジャッジ日時 | 2024-07-05 05:08:31 |
合計ジャッジ時間 | 8,093 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
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); } } }