結果
問題 | No.657 テトラナッチ数列 Easy |
ユーザー |
|
提出日時 | 2018-04-04 15:37:54 |
言語 | C++11 (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 500 bytes |
コンパイル時間 | 200 ms |
コンパイル使用メモリ | 24,832 KB |
実行使用メモリ | 13,884 KB |
最終ジャッジ日時 | 2024-06-26 08:49:49 |
合計ジャッジ時間 | 6,679 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 TLE * 2 -- * 2 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:6:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%d", &Q); | ~~~~~^~~~~~~~~~ main.cpp:11:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d", &n); | ~~~~~^~~~~~~~~~
ソースコード
#include<cstdio> #include<cstdlib> int main(void) { int i, j, n, a[5], Q; scanf("%d", &Q); int *b = (int *)calloc(Q, sizeof(int)); for (j = 0; j < Q; j++) { scanf("%d", &n); a[0] = 0; a[1] = 0; a[2] = 0; a[3] = 1; for (i = 0; i < n - 3; i++) { a[4] =( a[3] + a[2] + a[1] + a[0])%17; a[0] = a[1]; a[1] = a[2]; a[2] = a[3]; a[3] = a[4]; } b[j] = a[2]%17; } for (j = 0; j < Q; j++) { printf("%d", b[j]); printf("\n"); } return 0; }