1 solutions

  • 0
    @ 2026-11-15 12:55:54

    C++ :

    #include <bits/stdc++.h>
    using namespace std;
    
    int a[105];
    int main(){
        int n,x,ans = 0;
        cin >> n;
        for (int i = 1;i<=n;i++) {
            cin >> x;
            int cnt = 0;
            for (int j = 1;j*j<n;j++){
                if (x % j == 0) cnt += 2;
            }
            int r = sqrt(x);
            if (r * r == x) cnt ++;
            
            if (cnt %2 == 1) ans ++;
        };
        
        cout << ans;
        
        return 0;
    }
    
    • 1

    Information

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