#include <iostream>
#include <cmath>
using namespace std;

int main() {
    int n;
    cin >> n;

    int count = 0;
    for (int i = 1; i <= n; i++) {
        int divisors = 0;
        for (int j = 1; j <= sqrt(i); j++) {
            if (i % j == 0) {
                if (i / j == j) {
                    divisors++;
                } else {
                    divisors += 2;
                }
            }
        }
        if (divisors % 2 == 0) {
            count++;
        }
    }

    cout << count << endl;

    return 0;
}
``
练424 优秀数字小 H 是一个喜欢数数的人。我们称一个数是优秀的数字当且仅当其约数个数为偶数现在小 H 想知道1simn 中有多少个优秀的数字。【输入】一行一个数n1≤n≤2000。【输出】一行一个数表示答案请用c++代码写出

原文地址: https://www.cveoy.top/t/topic/iih1 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录