Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
6574 | 邓小龙 | 质数的和与积 | C++ | Accepted | 0 MS | 268 KB | 878 | 2025-03-08 09:32:54 |
#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 _max=0; cin>>s; for(int i=2;i<=s/2;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){ //cout<<a<<" "<<b<<" "<<a*b<<endl; _max=max(_max,a*b); } } cout<<_max<<endl; return 0; }