题解 | 查找组成一个偶数最接近的两个素数
using System;
public class Program {
public static void Main() {
int N=int.Parse(Console.ReadLine());
int HN=N/2;
int n1=0;
int n2=0;
for(int i=0;i<=HN;i++)
{
if(IsSuShu(HN-i)&&IsSuShu(HN+i))
{
n1=HN-i;
n2=HN+i;
break;
}
}
Console.WriteLine(n1);
Console.WriteLine(n2);
}
public static bool IsSuShu(int T)
{
bool Flag=true;
for(int i=2;i<T;i++)
{
if(T%i==0)
{
Flag=false;
break;
}
}
return Flag;
}
}
