SHARE
TWEET

Untitled

a guest Sep 19th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. ifstream f("placare1.in");
  7. ofstream g("placare1.out");
  8.  
  9. long long n,a,b,mc,h,v1,v2;
  10.  
  11. long long cmmmc(long long n,long long m)
  12. {
  13.     long long a=n,b=m,r,cmc;
  14.  
  15.     while(b!=0)
  16.     {
  17.         r=a%b;
  18.         a=b;
  19.         b=r;
  20.     }
  21.  
  22.     cmc=(m*n)/a;
  23.  
  24.     return cmc;
  25. }
  26.  
  27. int main()
  28. {
  29.     f>>n>>a>>b;
  30.  
  31.     mc=cmmmc(a,n);
  32.     v1=mc/n*b;
  33.  
  34.     mc=cmmmc(b,n);
  35.     v2=mc/n*a;
  36.  
  37.     g<<max(v1,v2);
  38.  
  39.     return 0;
  40. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top