【CF735D】Taxes【数论,数学】

题目大意:

题目链接:https://www.luogu.org/problemnew/show/CF735D
某人要交税,交的税钱是收入 n n n的最大因子(除了 n n n本身)。但是现在这人为了避税,把钱拆成几份,使交税最少,输出税钱。


思路:

当时看到是黑题,但是一翻讨论发现有人说是恶意评分,所以就想了一下。
结果发现很简单。
先分类讨论。

  • n = 1 n=1 n=1时,答案显然为1。
  • n n n是质数时,答案显然为1。
  • n n n是除了2以外的偶数时,根据哥德巴赫猜想,可以拆分成两个质数,答案为2。
  • n n n是除了质数以外的奇数时,只有 ( n − 2 ) + 2 (n-2)+2 (n2)+2才有可能是两个质数,所以如果 n − 2 n-2 n2是质数,那么答案就是2,否则可以拆分成 ( n − 3 ) + 3 (n-3)+3 (n3)+3,其中 n − 3 n-3 n3是偶数,3是质数,所以答案为3。

还是很简单的。


代码:

#include <cstdio>
using namespace std;

int n;

bool isprime(int x)  //O(sqrt(n))判断质数
{
	for (int i=2;i*i<=x;i++)
		if (!(x%i)) return 0;
	return 1;
}

int main()
{
	scanf("%d",&n);
	if (n==1||isprime(n)) return !printf("1");
	if ((!(n&1))||isprime(n-2)) return !printf("2");
	return !printf("3");
} 
2019年美赛D题是一个关于全球气候变化和碳排放的问题。该题要求设计一个可持续发展的政策来减少碳排放和改善全球气候变化的状况。 我们提出了一个名为“碳减排与森林保护联盟”的政策,旨在通过保护和恢复森林生态系统来减少碳排放和提高碳汇。该联盟在全球范围内创建合作伙伴关系,通过合作实施以下措施: 1. 森林保护和恢复:联盟成员国承诺保护和恢复本国境内的森林生态系统。通过减少森林消失和森林砍伐,可以减少碳排放并增加碳汇。 2. 技术创新和研发:联盟成员国将共同投资和推动碳减排技术和创新的研发。通过开发新的清洁能源技术和碳减排设备,可以减少工业和能源部门的碳排放。 3. 合作与经济激励:联盟成员国将共同建立碳交易市场,并通过碳定价和碳税等经济激励措施来引导和鼓励企业和个人减少碳排放。这将提供经济动力,以促进碳减排的实施。 该政策的目标是到2030年减少全球碳排放量,使全球平均气温上升幅度控制在2摄氏度以内。我们相信通过全球各国的合作和努力,实施这个政策可以取得长远的成功。 In 2019 MCM/ICM Problem D, we proposed a policy called "Carbon Emission Reduction and Forest Conservation Alliance" to tackle global climate change and carbon emissions. The policy aims to reduce carbon emissions and enhance carbon sinks through the protection and restoration of forest ecosystems. The alliance establishes partnerships on a global scale and implements the following measures through collaboration: 1. Forest Protection and Restoration: Member countries of the alliance commit to protect and restore their domestic forest ecosystems. By reducing deforestation and forest degradation, carbon emissions can be reduced while increasing carbon sinks. 2. Technological Innovations and Research & Development: Member countries of the alliance will jointly invest in and promote research and development of carbon emission reduction technologies and innovations. By developing new clean energy technologies and carbon emission reduction devices, carbon emissions from industrial and energy sectors can be reduced. 3. Cooperation and Economic Incentives: Member countries of the alliance will establish a carbon trading market and use economic incentives such as carbon pricing and carbon taxes to guide and encourage businesses and individuals to reduce carbon emissions. This will provide economic motivation to promote the implementation of carbon emission reduction measures. The policy aims to achieve a reduction in global carbon emissions by 2030, ensuring that the global average temperature rise is kept within 2 degrees Celsius. We believe that through the cooperation and efforts of countries worldwide, the implementation of this policy can achieve long-term success.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值