結果

問題 No.657 テトラナッチ数列 Easy
ユーザー ryoissy
提出日時 2018-03-02 22:24:42
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 347 bytes
コンパイル時間 1,348 ms
コンパイル使用メモリ 158,888 KB
実行使用メモリ 7,624 KB
最終ジャッジ日時 2024-06-13 03:13:19
合計ジャッジ時間 1,916 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:15:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |         scanf("%d",&q);
      |         ~~~~~^~~~~~~~~
main.cpp:18:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |                 scanf("%d",&n);
      |                 ~~~~~^~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int q;
int t[1000001];

int main(void){
	t[4]=1;
	for(int i=5;i<=1000000;i++){
		t[i]=(t[i-1]+t[i-2]+t[i-3]+t[i-4])%17;
	}
	scanf("%d",&q);
	for(int i=0;i<q;i++){
		int n;
		scanf("%d",&n);
		printf("%d\n",t[n]);
	}
	return 0;
}
0