forked from shashank077/Problems
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFIBEEASY.cpp
More file actions
33 lines (33 loc) · 679 Bytes
/
FIBEEASY.cpp
File metadata and controls
33 lines (33 loc) · 679 Bytes
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
#include<math.h>
#include <bits/algorithmfwd.h>
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ul unsigned long long
int main(){
ll T;
cin>>T;
ll arr[60] = {0};
arr[0] = 0;
arr[1] = 1;
ll sz=60;
for (ll i = 2; i <= sz; i++)
{
(arr[i] = (arr[i - 1] + arr[i - 2]) % 10);
}
//<<"=FUNCFIB@"<<i<<endl;
while(T--){
ul n0=0;
ll p=0;
cin>>n0;
while(n0>0){
n0 = n0 / 2;
p++;
}
//cout<<min1<<endl;
ll re = pow(2, p-1);
//cout<<"req"<<req<<endl;
cout<<arr[(re-1)%60]<<endl;
}
return 0;
}