Created
April 17, 2019 14:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
#define INF 1<<30 | |
#define maxn 100005 | |
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); | |
typedef long long ll; | |
map<ll, bool> ans; | |
void fib() | |
{ | |
ll a = 0; | |
ll b = 1; | |
ans[a] = true; | |
ans[b] = true; | |
ll c = a + b; | |
while(c <= 1e10){ | |
ans[c] = true; | |
a = b; | |
b = c; | |
c = a + b; | |
//cerr << c << endl; | |
} | |
} | |
int main() | |
{ | |
FASTIO | |
///* | |
//double start_time = clock(); | |
#ifndef ONLINE_JUDGE | |
freopen("in.txt", "r", stdin); | |
freopen("out.txt", "w", stdout); | |
freopen("error.txt", "w", stderr); | |
#endif //*/ | |
fib(); | |
int T; | |
cin >> T; | |
while(T--){ | |
ll x; | |
cin >> x; | |
if(ans[x]) cout << "IsFibo\n"; | |
else cout << "IsNotFibo\n"; | |
} | |
//double end_time = clock(); | |
//printf( "Time = %lf ms\n", ( (end_time - start_time) / CLOCKS_PER_SEC)*1000); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment