Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //In the Name of Allah Most Gracious, Most Merciful//
- /*If you want something you've never had, you have to do something you never did.*/
- #include<bits/stdc++.h>
- using namespace std;
- #define pb push_back
- #define ll long long
- #define pii pair<int,int>
- #define pll pair<ll,ll>
- #define M 100007
- #define INF 1e9
- #define INFL 1e18
- #define PI acos(-1)
- #define mp make_pair
- #define fast_in_out ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
- //const int fx[]= {+1,-1,+0,+0};
- //const int fy[]= {+0,+0,+1,-1};
- //const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1}; // Kings Move
- //const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1}; // Kings Move
- //const int fx[]={-2, -2, -1, -1, 1, 1, 2, 2}; // Knights Move
- //const int fy[]={-1, 1, -2, 2, -2, 2, -1, 1}; // Knights Move
- int prime[]={2,3,5,7,11,13,17,19,23};
- int n;
- int resnum;
- int resdiv;
- void HCNfunction(int pos,int limit,long long num,int div)
- {
- if(div>resdiv)
- {
- resnum=num;
- resdiv=div;
- }
- else if(div==resdiv && num<resnum)
- {
- resnum=num;
- }
- if(pos==9)
- return;
- long long p=prime[pos];
- for(int i=1;i<=limit;i++)
- {
- if(num*p>n)
- break;
- HCNfunction(pos+1,i,num*p,div*(i+1));
- p=p*prime[pos];
- }
- }
- int main ()
- {
- n = 1000000000;
- resnum = 0;
- resdiv = 0;
- HCNfunction( 0, 30, 1, 1 );
- printf ( "%d %d\n", resnum, resdiv );
- }
Advertisement
Add Comment
Please, Sign In to add comment