fork(1) download
  1. #include<bits/stdc++.h>
  2. #define MOD 1000000007
  3. #define quick ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
  4. using namespace std;
  5. typedef long long ll;
  6. typedef long double ld;
  7.  
  8. vector<ll> fibs(1000);
  9. int main()
  10. {
  11. ll t;
  12. cin>>t;
  13. fibs[1]=1;
  14. for(ll i=2;i<fibs.size();i++)
  15. fibs[i]=fibs[i-1]+fibs[i-2];
  16. while(t--)
  17. {
  18. ll a,b;
  19. cin>>a>>b;
  20. cout<<fibs[__gcd(a,b)]<<endl;
  21. }
  22. return 0;
  23. }
Success #stdin #stdout 0s 4284KB
stdin
2
3 6
0 1
stdout
2
1