Taxes
Mr. Funt now lives in a country with a very specific tax laws. The total income of mr. Funt during this
富特先生现在住在一个有着非常具体税法的国家。先生的总收入。在此期间
year is equalton(n >= 2 ) burles and the amount of tax he has to pay is calculated as the
年为相等年(n>=2),他必须缴纳的税额按
maximum divisor of n (not equal to n , of course). For example, ifn = 6 then Funt has to pay 3
N的最大除数(当然不等于n)。例如,IFN=6,那么Funt必须支付3
burles, while for n = 25 he needs to pay5andifn = 2 he pays only 1 burle.
伯勒斯,而在25岁时,他只需付1英镑。
As mr. Funt is a very opportunistic person he wants to cheat a bit. In particular, he wants to split the
作为先生派特是个非常机会主义的人,他想作弊一点。特别是,他想把
initial n in several partsn1 + n2+ … + Nk: = n (here k is arbitrary, evenk = 1 is allowed) and pay
初始n为1+n2+.+nk:=n(这里k是任意的,Evenk=1是允许的)并支付
the taxes for each part separately. He can’t make some part equal to 1 because it will reveal him. So,
每个部分的税收分开。他不能让某个部分等于1,因为这会暴露他。所以,
the conditionni > = 2 should hold for alli from1 to k .
条件ni>=2应适用于从1到k的alli。
Ostap Bender wonders, how many money Funt has to pay (i.e. minimal) if he chooses and optimal
OstapBender想知道,如果Funt选择和最优的话,他需要支付多少钱(也就是最低限度)?
way to split n in parts.
把n分成几个部分的方法。
一个非素偶数能分成两个质数
一个非素质数能分成2与一个质数或这分成三个质数
如果发现反例偷偷告诉我,我给你转20
bool prime(int n)
{
if (n<2)return 0;
for (int i = 2; i*i <=n ; ++i) {
if (n%i==0)return 0;
}
return 1;
}
int main() {
int n;
cin>>n;
if(prime(n))cout<<1<<endl;
else if(n%2==0)cout<<2<<endl;
else if (prime(n-2))cout<<2<<endl;
else cout<<3<<endl;
return 0;
}