結果
問題 | No.657 テトラナッチ数列 Easy |
ユーザー |
|
提出日時 | 2018-04-04 16:09:57 |
言語 | C (gcc 13.3.0) |
結果 |
RE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 509 bytes |
コンパイル時間 | 165 ms |
コンパイル使用メモリ | 30,464 KB |
実行使用メモリ | 5,760 KB |
最終ジャッジ日時 | 2024-06-26 08:50:39 |
合計ジャッジ時間 | 1,096 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 RE * 1 |
other | AC * 13 |
ソースコード
#include<stdio.h> #include<stdlib.h> int main(void) { int Q; int n[10000]; unsigned int max = 1; int tmp = 0; scanf("%d", &Q); for (int j = 0; j < Q; j++) { scanf("%d", &n[j]); if (max < n[j]) max = n[j]; } int *tt = (int *)calloc(max, sizeof(int)); tt[0] = 0; tt[1] = 0; tt[2] = 0; tt[3] = 1; if (max > 4) { for (int k = 4; k <= max; k++) { tt[k] = (tt[k - 1] + tt[k - 2] + tt[k - 3] + tt[k - 4]) % 17; } } for (int i = 0; i < Q; i++) printf("%d\n", tt[n[i]-1]); return 0; }