1 solutions

  • 0
    @ 2025-11-5 19:42:35

    C++ :

    #include <bits/stdc++.h>
    using namespace std;
    
    bool f(int x) {
    	if (x < 2) return false;
    	for (int i = 2; i <= x / i; i ++) {
    		if (x % i == 0) {
    			return false;
    		}
    	}
    	return true;
    }
    
    int main() {
    	int cnt = 0;
    	for (int i = 100; i <= 200; i ++) {
    		if (f(i)) {
    			cnt ++;
    		}
    	}
    	cout << cnt << endl;
    	for (int i = 100; i <= 200; i ++) {
    		if (f(i)) {
    			cout << i << ' ';
    		}
    	}
    
    	return 0;
    }
    
    
    • 1

    Information

    ID
    19574
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By