SHARE
TWEET

Untitled

a guest Aug 22nd, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. #include<stdio.h>
  3. #include<math.h>
  4. using namespace std;
  5. int cp[1000005];
  6. int main(){
  7.     for(int i=1;i<=1000000;i++){
  8.         for(int j=i;j<=1000000;j+=i){
  9.             cp[j]++;
  10.         }
  11.     }
  12.     int a,b,c,d;
  13.     cin>>a>>b>>c>>d;
  14.     int mx=0,a1,a2;
  15.     for(int i=1;i<=1000000;i++){
  16.         int x = floor(b/i)*b;
  17.         int y = floor(d/i)*d;
  18.         if(x>=a&&y>=b){
  19.             if(mx< cp[i]){
  20.                 mx=cp[i];a1=x;a2=y;
  21.             }
  22.             else if(mx==cp[i]&&a1+a2<x+y){
  23.                 a1=x;a2=y;
  24.             }
  25.         }
  26.     }
  27.     printf("%d %d",a1,a2);
  28. }
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