Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
949 曾浩森 质数的和与积 C++ Accepted 1 MS 268 KB 384 2023-05-27 16:01:51

Tests(10/10):


Code:

#include<cmath> #include<iostream> using namespace std; bool p(int k){ for(int i=sqrt(k);i>1;i--){ if(k%i==0) return 0;} return 1; } int main(){ int a=1,b,s,max=0; cin>>s; while(a<s){ b=s-a; if(p(a)&&p(b)) if(max<a*b) max=a*b; a++; } cout<<max; }