/**
[math] hdu 3816 to be no. one
一道没有输入的spj的计算,老是感觉代码写的好搓
1/n= 1/(a*b)=1/a*(a+b) + 1/b*(a+b)
*/
#include <stdio.h>
#include <math.h>
#include <algorithm>
using namespace std;
int f[19][19] = {
{},{},{},{0,2,3,6}};
void cal(int k,int &a,int &x,int &y)
{
int i,j,b,m;
for(i = 2; i < k; ++i)
{
m =sqrt(f[k][i] * 1.0);
for(a = 1; a <= m; ++ a)
if(f[k][i] % a == 0)
{
b = f[k][i] / a;
if(a == b)
continue;
x = (a + b) * a;
y = (a + b) * b;
if(x > k * k || y > k * k)
continue;
for(j = 1
[math] hdu 3816 to be no. one
最新推荐文章于 2019-09-29 17:14:43 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)