結果

問題 No.657 テトラナッチ数列 Easy
ユーザー Mcpu3Mcpu3
提出日時 2018-08-28 00:01:05
言語 Java21
(openjdk 21)
結果
AC  
実行時間 394 ms / 2,000 ms
コード長 459 bytes
コンパイル時間 2,482 ms
コンパイル使用メモリ 72,140 KB
実行使用メモリ 65,084 KB
最終ジャッジ日時 2023-09-19 09:15:04
合計ジャッジ時間 7,368 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 147 ms
60,080 KB
testcase_01 AC 147 ms
60,104 KB
testcase_02 AC 147 ms
60,172 KB
testcase_03 AC 148 ms
59,876 KB
testcase_04 AC 147 ms
60,368 KB
testcase_05 AC 354 ms
64,756 KB
testcase_06 AC 146 ms
59,884 KB
testcase_07 AC 148 ms
59,892 KB
testcase_08 AC 148 ms
59,836 KB
testcase_09 AC 378 ms
64,476 KB
testcase_10 AC 379 ms
64,472 KB
testcase_11 AC 382 ms
64,692 KB
testcase_12 AC 382 ms
64,928 KB
testcase_13 AC 384 ms
64,504 KB
testcase_14 AC 383 ms
64,472 KB
testcase_15 AC 394 ms
65,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int q=sc.nextInt(),n,t[]=new int[5],a[]=new int[1000000],i,j;
		for(i=0;i<4;i++) {
			t[i]=i/3;
			a[i]=i/3;
		}
		for(i=4;i<1000000;i++) {
			t[4]=(t[0]+t[1]+t[2]+t[3])%17;
			a[i]=t[4];
			for(j=0;j<4;j++) t[j]=t[j+1];
		}
		for(i=0;i<q;i++) {
			n=sc.nextInt();
			System.out.println(a[n-1]);
		}
		sc.close();
	}
}
0