欧拉计划第29题
作者:
brivia
,
2024-02-25 16:42:42
,
所有人可见
,
阅读 35
/*
欧拉计划第29
暴力枚举
腾讯云上运行时间:
real 0m1.553s
user 0m1.540s
sys 0m0.000s
*/
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> PII;
const double eps = 0.00000001;
const int N = 100;
set<PII> s;
int main(void)
{
for (int x = 2; x <= N; ++ x)
for (int y = 2; y <= N; ++ y)
{
bool flag = true; // 可以将{x,y}插入set中。
for (auto t: s)
{
int a = t.first, b = t.second;
if (fabs(b * log(a) - y * log(x)) < eps)
{
flag = false; // 不能插入
break;
}
}
if (flag) s.insert({x, y});
}
cout << s.size() << endl;
return 0;
}