1 條題解

  • 0
    @ 2026-1-16 17:45:12

    #include<bits/stdc++.h> using namespace std; int a,b; bool isPrime(int x){ for(int i=2; i*i<=x; i++){ if(x % i == 0) return false; } return true; } int main(){ cin>>a>>b; int ans=0; for(int j=a; j<=b; j++){ if(isPrime(j)) ans++; } cout<<ans; return 0; }

    資訊

    ID
    9138
    時間
    1000ms
    記憶體
    128MiB
    難度
    3
    標籤
    遞交數
    6
    已通過
    5
    上傳者