Free Contest 75 - FPRIME

View as PDF

Submit solution

Points: 0.06 (partial)
Time limit: 1.0s
Memory limit: 256M

Problem type
Allowed languages
C, C++, Go, Java, Kotlin, Pascal, PyPy, Python, Rust, Scratch

In case the statement didn't load correctly, you can download the statement here: Statement

Lưu ý: các bạn không nhập, xuất dữ liệu bằng file kể cả khi đề bài có yêu cầu. Đọc, ghi dữ liệu được thực hiện ở stdin và stdout.


Comments

Please read the guidelines before commenting.



  • 0
    lephuclong11  commented on April 17, 2026, 1:44 p.m.

    mấy bồ ơi sao mình sinh test 10e7 chạy 0,55s mà sao vẫn chạy TLE vậy:

    include <bits/stdc++.h>

    using namespace std; int n; vector<long long> a;

    bool check (int x) { if(x == 2) return true; if(x < 2) return false; if(x % 2 == 0) return false;

    for(int i = 3; i <= sqrt(x); i += 2) {
        if(x%i == 0) return false;
    }
    
    
    return true;
    

    } int main() { iosbase::syncwith_stdio(false); cin.tie(NULL); cin >> n; a.resize(n+1);

    for(int i = 1; i <= n; i ++) {
        cin >> a[i];
    
        if(check(a[i])) cout <<"YES"<<'\n';
        else cout <<"NO"<<'\n';
    }
    
    
    return 0;
    

    }


    • 1
      4npg  commented on April 17, 2026, 2:56 p.m.

      sàng đi ông


  • 0
    DucTri  commented on Dec. 8, 2025, 8:10 a.m.

    include <bits/stdc++.h>

    using namespace std;

    define ll long long

    const ll N =1e7+1; ll a[N],n,l,r,snt[N],d[N],k; vector<ll> vec; int main(){ iosbase::syncwith_stdio(0); cin.tie(0); for(int i=1;i<=N;i++) snt[i]=1; snt[1]=0; for(int i=2;i<=sqrt(N);i++) if(snt[i]==1){ for(int j=i*i;j<=N;j+=i) snt[j]=0; } cin>>k; while(k--){ cin>>n; if(snt[n]==1) cout<<"YES"<<"\n"; else cout<<"NO"<<"\n"; } return 0; }


  • 0
    dailamsiu  commented on June 2, 2025, 7:27 a.m.

    bai duoi qua


  • 2
    NVTai  commented on March 22, 2025, 3:08 p.m.

    Nếu như sàng nguyên tố mà dùng mảng kiểu bool hoặc long long thì nhớ dùng '\n' thay cho endl để không bị TLE nhé, còn dùng bitset như mảng thì khỏi cần!


    • -1
      bietko  commented on May 4, 2025, 3:35 a.m.

      anh qua dep trai


  • -19
    Hung1504  commented on Feb. 25, 2024, 4:06 p.m. edited

    This comment is hidden due to too much negative feedback. Show it anyway.