AMIFIB - Editorial

@vineetpaliwal: Indeed. I completely agree that nothing can be done in general. But at least the tester’s solution could have been ensured for sanity if you had included such common hashes. And anyways, why let such problems be included for contests when you know about the possible discrepancies beforehand? Aren’t such things checked by contest organizers/admins? Moreover, don’t you think this problem was biased towards Python/Java programmers?

1 Like

what is wrong in my solution ??

Please tell, how is checkSquare() method implemented in author’s solution? Which formulae is used to check whether a number is perfect square or not? Any link/information will be highly appreciated.
Thanks

here is simplest solution by RAJAT De

hi here is a simple code
#include <stdio.h>
 #include <string.h>
 #include<iostream>

 using namespace std;
 long long c(char *s){

 long long i,n=0;
    for(i=0;i<strlen(s);i++)
        n=10*n+s[i]-'0';
      return n;
    }

  int main()
 {

            int t;
           cin>>t;

      while(t--)
    {
      long long a[6000],i,m;
      char s[1001];
      cin>>s;
      m=c(s);

      a[0]=1;a[1]=1;

      for(i=2;i<6000;i++){
          a[i]=a[i-1]+a[i-2];
          if(a[i]==m){
             cout<<"YES"<<endl;
             break;
          }
         if(i==5999){
          cout<<"NO"<<endl;
        }
    }
   }
   return 0;
 }

HAPPY CODING
can anyone explain how it does work with long string

hey,can anyone tell me the error in the code, i am using property 5nn + 4 or 5nn - 4 or both are perfect square to solve it .https://www.codechef.com/viewsolution/10523345

For those who are saying this question was biased towards JAVA, Well then I solved this problem in C++ in 5 minutes https://www.codechef.com/status/AMIFIB,lmao_ and make sure you save my template so that you can do the BIGINTEGER stuff in c++ using strings.