Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
6568 | 刘芃伽 | 质数的和与积 | C++ | Accepted | 0 MS | 256 KB | 820 | 2025-03-08 09:18:00 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<algorithm> #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int s,a,b; int m=0; cin>>s; for(int i=2;i<=s/2+1;i++){ a=i; b=s-a; bool f=true; for(int j=2;j*j<=a;j++){ if(a%j==0){ f=false; break; } } if(f==false) continue; f=true; for(int j=2;j*j<=b;j++){ if(b%j==0){ f=false; break; } } if(f==true){ m=max(m,a*b); } } cout<<m<<endl; return 0; }