Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
329982 刘明樾 GESP:2023-6月等级2-T1-找素数 C++ 通过 100 0 MS 272 KB 423 2024-12-27 15:25:45

Tests(5/5):


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


测评信息: