結果
問題 | No.657 テトラナッチ数列 Easy |
ユーザー |
![]() |
提出日時 | 2018-05-06 16:55:25 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 28 ms / 2,000 ms |
コード長 | 357 bytes |
コンパイル時間 | 443 ms |
コンパイル使用メモリ | 54,356 KB |
実行使用メモリ | 7,424 KB |
最終ジャッジ日時 | 2024-06-28 02:09:39 |
合計ジャッジ時間 | 1,396 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
#include<iostream> using namespace std; int n[10005]; int t[1000005]; int main() { int q;cin>>q; t[0] = 0; t[1]=0;t[2]=0;t[3]=0;t[4]=1; int idx = 5; while(1) { t[idx] = t[idx-1]+t[idx-2]+t[idx-3]+t[idx-4]; t[idx] %= 17; idx++; if(idx > 1000000) break; } for(int i=0;i<q;i++) { int n;cin>>n; cout << t[n] << endl; } return 0; }