10413 | 2024-04-01 22:13:01 | 111 | Kiváló számok 2 | cpp17 | Runtime error 71/100 | 13ms | 7140 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define MOD 1000000007
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin>>T;
while(T--){
int N;
cin>>N;
vector<int>v(N+1);
v[0]=1;
v[1]=0;
v[2]=2;
for(int i=3;i<=N;i++){
v[i]=(v[i-2]*2+v[i-1])%MOD;
}
cout<<v[N]<<'\n';
}
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1880 KiB | ||||
subtask2 | 13/13 | ||||||
2 | Accepted | 3ms | 2016 KiB | ||||
3 | Accepted | 3ms | 2236 KiB | ||||
subtask3 | 24/24 | ||||||
4 | Accepted | 3ms | 2460 KiB | ||||
5 | Accepted | 3ms | 2672 KiB | ||||
6 | Accepted | 3ms | 2768 KiB | ||||
7 | Accepted | 3ms | 2856 KiB | ||||
subtask4 | 34/34 | ||||||
8 | Accepted | 10ms | 6992 KiB | ||||
9 | Accepted | 12ms | 6960 KiB | ||||
10 | Accepted | 10ms | 6144 KiB | ||||
11 | Accepted | 13ms | 7140 KiB | ||||
subtask5 | 0/29 | ||||||
12 | Runtime error | 4ms | 3252 KiB | ||||
13 | Runtime error | 4ms | 3252 KiB | ||||
14 | Runtime error | 4ms | 3452 KiB | ||||
15 | Runtime error | 4ms | 3256 KiB | ||||
16 | Runtime error | 4ms | 3256 KiB | ||||
17 | Runtime error | 4ms | 3516 KiB | ||||
18 | Runtime error | 4ms | 3468 KiB |