結果

問題 No.658 テトラナッチ数列 Hard
ユーザー kotatsugame
提出日時 2019-10-12 08:30:01
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 278 bytes
コンパイル時間 662 ms
コンパイル使用メモリ 65,120 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-27 08:47:39
合計ジャッジ時間 1,876 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
main()
{
	int Q;
	cin>>Q;
	for(;Q--;)
	{
		long N;cin>>N;N=(N-1)%4912+1;
		if(N<4)cout<<0<<endl;
		else
		{
			int A=0,B=0,C=0,D=1;
			for(int i=4;i<N;i++)
			{
				int E=(A+B+C+D)%17;
				A=B;B=C;C=D;D=E;
			}
			cout<<D<<endl;
		}
	}
}
0