You are viewing a single comment's thread. Return to all comments →
failing test case 6 to 9 dont know why any help?
using namespace std;
bool isPerfectSquare(long long x) { long long s = sqrt(x); return (s*s == x); }
bool isFibonacci(long long n) {
return isPerfectSquare(5LL*n*n + 4) || isPerfectSquare(5LL*n*n - 4);
}
int main() { long long N; cin >> N;
while (N--) { long long x; cin >> x; if (isFibonacci(x)) cout<<"IsFibo"<
return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Is Fibo
You are viewing a single comment's thread. Return to all comments →
failing test case 6 to 9 dont know why any help?
include
include
include
include
include
using namespace std;
bool isPerfectSquare(long long x) { long long s = sqrt(x); return (s*s == x); }
bool isFibonacci(long long n) {
}
int main() { long long N; cin >> N;
while (N--) { long long x; cin >> x; if (isFibonacci(x)) cout<<"IsFibo"<
return 0; }