forked from tanishqchamola/Hacktober2020
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfibeasy.cpp
51 lines (45 loc) · 911 Bytes
/
fibeasy.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
39
40
41
42
43
44
45
46
47
48
49
50
51
//
// fibeasy.cpp
// codechef
//
// Created by Tanishq Chamola on 14/09/19.
// Copyright © 2019 Tanishq Chamola. All rights reserved.
//
#include <iostream>
#include <math.h>
#include <vector>
using namespace std;
//partially correct
/*
int main()
{
unsigned int t,max=0;
cin>>t;
vector<int> fib;
int n[t];
int pos[t];
//input test cases
for (int i=0; i<t; i++)
{
cin>>n[i];
}
//finds max series required to be found
for (unsigned long long int i=0; i<t; i++) {
pos[i] = pow(2,floor(log2(n[i])))-1;
if(pos[i]>max){
max=pos[i];
}
}
fib.push_back(0);fib.push_back(1);
for(unsigned long long int k=2;k<=max;k++)
{
int num = (fib[k-1]+fib[k-2])%10;
fib.push_back(num);
}
for(int i=0;i<t;i++)
{
cout<<fib[pos[i]]<<endl;
}
return 0;
}
*/