1 solutions

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

    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 n;
    	cin >> n;
    	
    	if (f(n)) cout << 'Y';
    	else cout << 'N';
    
    	return 0;
    }
    
    
    • 1

    Information

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