Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
319955 沈悦 【C5-T】质数的和与积 C++ 通过 100 2 MS 256 KB 364 2025-05-03 13:10:23

Tests(10/10):


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


测评信息: