10414 | 2024-04-01 22:49:27 | 111 | Kiváló számok 2 | cpp17 | Runtime error 71/100 | 101ms | 7616 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define MOD 1000000007
int pow_mod(int x,int p){
int r=1;
while(p){
if(p%2){
r*=x;
r%=MOD;
}
x*=x;
x%=MOD;
p/=2;
}
return r;
}
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;
for(int i=2;i<=N;i++){
v[i]=(pow_mod(2,i-2)+v[i-2])%MOD;
}
cout<<v[N]<<'\n';
}
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1836 KiB | ||||
subtask2 | 13/13 | ||||||
2 | Accepted | 3ms | 2032 KiB | ||||
3 | Accepted | 3ms | 2248 KiB | ||||
subtask3 | 24/24 | ||||||
4 | Accepted | 3ms | 2468 KiB | ||||
5 | Accepted | 3ms | 2560 KiB | ||||
6 | Accepted | 3ms | 2684 KiB | ||||
7 | Accepted | 3ms | 2904 KiB | ||||
subtask4 | 34/34 | ||||||
8 | Accepted | 87ms | 7124 KiB | ||||
9 | Accepted | 98ms | 7348 KiB | ||||
10 | Accepted | 82ms | 6464 KiB | ||||
11 | Accepted | 101ms | 7616 KiB | ||||
subtask5 | 0/29 | ||||||
12 | Runtime error | 4ms | 3808 KiB | ||||
13 | Runtime error | 4ms | 3808 KiB | ||||
14 | Runtime error | 4ms | 3932 KiB | ||||
15 | Runtime error | 4ms | 3904 KiB | ||||
16 | Runtime error | 4ms | 3908 KiB | ||||
17 | Runtime error | 4ms | 3908 KiB | ||||
18 | Runtime error | 4ms | 4052 KiB |