【一月份 -- 基础语法组】-- T3 --股勾定理

· · 个人记录

网址: https://cspjs.online/contest/648/problem/3

题解: https://b1bznc26af6.feishu.cn/file/PdQqbB3WQoKO8kxtdgvcUbD1n5e?from=from_copylink

#include <bits/stdc++.h>
using namespace std;
int main() {
    freopen("theorem.in", "r", stdin);
    freopen("theorem.out", "w", stdout);
    int n, cnts = 0;
    cin >> n;
    for (int i = 1; i <= sqrt(n); i++) {
        for (int j = 1; j <= sqrt(n); j++) {
            if (i * i + j * j < n) {
                cnts++;
            }
        }
    }
    cout << cnts;
    return 0;
}