#include using namespace std;

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

int count = 0;
for (int i = 1; i <= n; i++) {
    if (i % 3 == 2 && i % 5 == 3 && i % 7 == 2) {
        count++;
    }
}

cout << count << endl;

return 0;

}

c++【入门】求满足条件的整数个数说明在1-n中找出能同时满足用3除余2用5除余3用7除余2的所有整数的个数如果没有请输出0。输入格式输入一行只有一个整数n1=n=2000输出格式输出只有一行这意味着末尾有一个回车符号包括1个整数。

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

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