結果
問題 | No.658 テトラナッチ数列 Hard |
ユーザー | shikaku |
提出日時 | 2018-04-25 09:27:59 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 21 ms / 2,000 ms |
コード長 | 926 bytes |
コンパイル時間 | 434 ms |
コンパイル使用メモリ | 61,376 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-09-10 05:23:59 |
合計ジャッジ時間 | 1,268 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 1 ms
4,380 KB |
testcase_03 | AC | 2 ms
4,376 KB |
testcase_04 | AC | 18 ms
4,376 KB |
testcase_05 | AC | 18 ms
4,380 KB |
testcase_06 | AC | 19 ms
4,376 KB |
testcase_07 | AC | 18 ms
4,376 KB |
testcase_08 | AC | 20 ms
4,376 KB |
testcase_09 | AC | 21 ms
4,380 KB |
testcase_10 | AC | 20 ms
4,376 KB |
ソースコード
#include <iostream> #include <vector> using namespace std; int main(){ long long q, i, s; long long m = 0; cin >> q; vector<long long> n(q); for( i = 0 ; i < q ; i = i + 1 ){ cin >> s; if( 4912 < s && s % 4912 != 0 ) n.at(i) = s % 4912; else if( s % 4912 == 0 ) n.at(i) = 4912; else n.at(i) = s; if( n.at(i) > m ) m = n.at(i); } vector<long long> t(m + 1); t.at(1) = 0; t.at(2) = 0; t.at(3) = 0; t.at(4) = 1; for( i = 5 ; i <= m ; i = i + 1 ){ t.at(i) = ( t.at(i - 1) + t.at(i - 2) + t.at(i - 3) + t.at(i - 4) ) % 17; } for( i = 0 ; i < q ; i = i + 1 ){ cout << t.at( n.at(i) ) << endl; } return 0; }