标签:geo lld type pos nbsp time 最大 正整数 tar
(1<=N<=2,000,000,000)
#include <cstring> #include <algorithm> #include <cstdio> #include <cstdlib> #include <cmath> using namespace std; typedef long long LL; const LL prime[11]={2,3,5,7,11,13,17,19,23,29}; LL n,ans,cnt; void dfs(LL times,int pos,int ysz,int maxv){ if (ysz>cnt) ans=times,cnt=ysz; else if (ysz==cnt&×<ans) ans=times,cnt=ysz; for (int i=1;i<=maxv;i++){ times*=prime[pos]; if (times>n) return; dfs(times,pos+1,ysz*(i+1),i); } } int main(){ scanf("%d",&n); ans=cnt=0; dfs(1,0,1,33); printf("%lld",ans); return 0; }
标签:geo lld type pos nbsp time 最大 正整数 tar
原文地址:http://www.cnblogs.com/zhouzhendong/p/7351322.html