Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
109916 揭伟琦 质数的和与积 C++ Accepted 23 MS 276 KB 354 2025-02-13 12:10:24

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; bool z(int x) { if(x<2) { return 0; } for(int i=2; i<=x-1; i++) { if(x%i==0) { return 0; } } return 1; } int main() { int s; cin >>s; int mx=0; for(int x=2; x<=s; x++) { if(z(x)&&z(s-x)) { if(x*(s-x)>mx) { mx=x*(s-x); } } } cout <<mx; return 0; }