-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontest1_ansgen.cpp
38 lines (34 loc) · 920 Bytes
/
contest1_ansgen.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include<iostream>
#include<time.h>
#define mod 1000000007
using namespace std;
long long ans[200001] = {0};
int main() {
string in_name = "Test_Case_",out_name = "Output_";
FILE *fpin,*fpout,*temp;
ans[0] = 0;
ans[1] = 1;
for(int i = 2;i <= 200000;i++){
ans[i] = (ans[i-1] + ans[i-2])%mod;
}
for(int i = 1;i <= 7;i++){
in_name += char(i+'0');
out_name += char(i+'0');
fpin = freopen(in_name.c_str(),"r",stdin);
fpout = freopen(out_name.c_str(),"w",stdout);
int T;
cin>>T;
while(T--) {
int N;
cin>>N;
cout<<ans[N]<<"\n";
}
in_name.pop_back();
out_name.pop_back();
fclose(fpin);
fclose(fpout);
}
temp = freopen("../cp/output.txt","w",stdout);
cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec"<<endl;
fclose(temp);
}