题解 | #等比数列三角形#
等比数列三角形
https://ac.nowcoder.com/acm/problem/25520
等比数列三角形题解
实现思路
代码实现
/*
* @Description: 电影和人生不一样,电影太仁慈了,人生太辛苦了
* @CSDN: https://blog.csdn.net/godhandsjoker?spm=1000.2115.3001.5343
* @Github: https://github.com/godhandsjoker
* @QQ: 3124406837
* @Author: godhands
* @LastEditTime: 2022-04-28 10:42:09
*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve() {
int n, res = 0;
double maxk = (1 + sqrt(5)) / 2;
cin >> n;
for (int i = 1; i <= n / i; i++) {
for (int j = i; j <= i * maxk; j++) {
if (__gcd(i, j) == 1) res += n / j / j;
}
}
cout << res << "\n";
}
signed main() {
ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
solve();
return 0;
}
团队的题解 文章被收录于专栏
简单记录一些团队朋友们和自己的题解