Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
72786 张江鹏 质数的和与积 C++ Compile Error 0 MS 0 KB 358 2024-05-12 18:09:22

Tests(0/0):


Code:

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


Run Info:

Main.cc: In function 'int main()':
Main.cc:6:17: error: a function-definition is not allowed here before '{' token
 int prime(int x){
                 ^
Main.cc:31:1: error: expected '}' at end of input
 }
 ^