1.链接地址:
http://bailian.openjudge.cn/practice/1183
http://poj.org/problem?id=1183
2.题目:
3.思路:
数学题,暴力枚举会超时
思路参考http://hi.baidu.com/sjzezoi/item/f563a11c6accf0dd65eabff8
4.代码:
#include <iostream>
#include <cstdio> using namespace std; int main()
{
long long a;
cin>>a; long long m;
for(m = a; m > ; --m)
{
if((a * a + ) % m == ) break;
}
cout<<(a * + m + (a * a + ) / m)<<endl; return ;
}