結果

問題 No.658 テトラナッチ数列 Hard
ユーザー 👑 tatt61880tatt61880
提出日時 2021-03-01 19:09:51
言語 Kuin
(KuinC++ v.2021.9.17)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 470 bytes
コンパイル時間 1,968 ms
コンパイル使用メモリ 148,484 KB
実行使用メモリ 4,392 KB
最終ジャッジ日時 2023-10-14 17:31:48
合計ジャッジ時間 3,103 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 3 ms
4,356 KB
testcase_03 AC 3 ms
4,352 KB
testcase_04 AC 15 ms
4,352 KB
testcase_05 AC 16 ms
4,348 KB
testcase_06 AC 16 ms
4,348 KB
testcase_07 AC 16 ms
4,348 KB
testcase_08 AC 18 ms
4,348 KB
testcase_09 AC 19 ms
4,352 KB
testcase_10 AC 18 ms
4,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

func main()
	var t: []int :: #[17 ^ 4]int
	var i: int :: 4
	var num: int :: 1
	do t[3] :: 1
	while loop(true)
		do t[i] :: (num + 17) % 17
		do num :- t[i - 4]
		do num :+ t[i]
		
		var v: int :: t[i - 3] * 17 ^ 3 + t[i - 2] * 17 ^ 2 + t[i - 1] * 17 + t[i]
		if(v = 1)
			break loop
		end if
		do i :+ 1
	end while
	var mod: int :: i - 3
	
	var q: int :: cui@inputInt()
	for(1, q)
		var n: int :: cui@inputInt()
		do cui@print("\{t[(n - 1) % mod]}\n")
	end for
end func
0