104132024-04-01 22:13:01111Kiváló számok 2cpp17Runtime error 71/10013ms7140 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;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1880 KiB
subtask213/13
2Accepted3ms2016 KiB
3Accepted3ms2236 KiB
subtask324/24
4Accepted3ms2460 KiB
5Accepted3ms2672 KiB
6Accepted3ms2768 KiB
7Accepted3ms2856 KiB
subtask434/34
8Accepted10ms6992 KiB
9Accepted12ms6960 KiB
10Accepted10ms6144 KiB
11Accepted13ms7140 KiB
subtask50/29
12Runtime error4ms3252 KiB
13Runtime error4ms3252 KiB
14Runtime error4ms3452 KiB
15Runtime error4ms3256 KiB
16Runtime error4ms3256 KiB
17Runtime error4ms3516 KiB
18Runtime error4ms3468 KiB