Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
7415 黄言岐 判断素数II C++ Accepted 5 MS 272 KB 724 2025-04-25 20:48:48

Tests(10/10):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int my_sum(int y){ int ans=0; for(int i=2;i<=y;i++){ if(i==2){ ans+=1; continue; } for(int j=2;j<=i/2+1;j++){ if(i%j==0){ break; } if(j==i/2+1&&i%j!=0){ ans+=1; } } } return ans; } int main(){ int d; cin>>d; cout<<my_sum(d)<<endl; return 0; }