nickzuck_007

cc solution

Jul 15th, 2020
911
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std ;
  4.  
  5. long long findLCM(long long a, long long b){
  6.     return (a*b)/__gcd(a,b);
  7. }
  8.  
  9. int main(){
  10.  
  11.     long long t, a, b, k;
  12.     cin >> t ;
  13.     while(t--){
  14.         cin >> a >> b >> k ;
  15.         int lcm = findLCM(a, b);
  16.         int aDivs = MAX_LIMIT / a ;
  17.         int bDivs = MAX_LIMIT / b ;
  18.         int lcmDivs = MAX_LIMIT / lcm ;
  19.         int totalDivs =  aDivs + bDivs - lcmDivs ;
  20.         if (totalDivs < k){
  21.             cout << "true" ;
  22.         } else {
  23.             cout << "false";
  24.         }
  25.     }
  26.  
  27.     return 0 ;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment