/ Randle /

记录详情

Accepted


  
# 状态 耗时 内存占用
#1 Accepted 4ms 360.0 KiB
#2 Accepted 3ms 352.0 KiB
#3 Accepted 3ms 376.0 KiB
#4 Accepted 3ms 340.0 KiB
#5 Accepted 3ms 360.0 KiB
#6 Accepted 3ms 352.0 KiB
#7 Accepted 3ms 360.0 KiB
#8 Accepted 3ms 352.0 KiB
#9 Accepted 3ms 376.0 KiB
#10 Accepted 3ms 340.0 KiB

代码

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
using namespace std;
long long n, maxd, ans;
int prime[] = {0, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41};
void dfs(int x, long long sum, long long nowd, long long Limit) {
	if (nowd > maxd || (nowd == maxd && sum < ans))
		maxd = nowd, ans = sum;
	if (x > 11) return;
	for (int i = 1; sum * prime[x] <= n && i <= Limit; i++)
		dfs(x + 1, sum *= prime[x], nowd * (i + 1), i);
}
int main()
{
	//freopen("divisors.in","r",stdin);
	//freopen("divisors.out","w",stdout);
	cin >> n;
	ans = 1;
	if (n > 1) dfs(1, 1, 1, 1e9);
	cout << ans << endl;
	return 0;  
}

信息

递交者
类型
递交
题目
最佳进制 T1
题目数据
下载
语言
C++
递交时间
2017-10-06 20:10:50
评测时间
2017-10-06 20:10:50
评测机
分数
100
总耗时
34ms
峰值内存
376.0 KiB