目大意:给你$n$,把它分成若干个数$n_i$,记价值为$\sum_{i=1}^k(\sum_{j|n_i}j-n_i)$(即分成的每个数的约数和(不包括自身))。(以前写的题,不知道为什么没交)

题解:分成质数,根据哥德巴赫猜想,大于$2$的偶数都可以分成两个质数的和,那么奇数有$3$中可能:$1.$自己是质数;$2.$分成$2$和一个质数;$3.$分成一个质数和一个偶数(再分成两个质数)

卡点:

C++ Code:

#include <cstdio>
#include <cstdlib>
#include <cmath>
inline bool check(int x) {
int t = sqrt(x);
for (int i = 2; i <= t; i++) if (x % i == 0) return false;
return true;
}
inline void Halt(int x) {
printf("%d\n", x);
exit(0);
}
int n;
int main() {
scanf("%d", &n);
if (check(n)) Halt(1);
if (n & 1) {
if (check(n - 2)) Halt(2);
else Halt(3);
} else Halt(2);
return 0;
}

  

[CF735D]Taxes的更多相关文章

  1. CF735D Taxes 哥德巴赫猜想\判定素数 \进一步猜想

    http://codeforces.com/problemset/problem/735/D 题意是..一个数n的贡献是它的最大的因子,这个因子不能等于它本身 然后呢..现在我们可以将n拆成任意个数的 ...

  2. [CF45G]Prime Problem

    题目大意:将$1$到$n(1<n\leqslant6000)$分成若干组数,要求每组数的和均为质数,若存在一种分配方式,输出每个数所在的组的编号,有多组解输出任意一组解,若不存在,输出$-1$ ...

  3. code forces 382 D Taxes(数论--哥德巴赫猜想)

    Taxes time limit per test 2 seconds memory limit per test 256 megabytes input standard input output ...

  4. Codeforces Round #382 (Div. 2) D. Taxes 哥德巴赫猜想

    D. Taxes 题目链接 http://codeforces.com/contest/735/problem/D 题面 Mr. Funt now lives in a country with a ...

  5. Codeforces Round #382 (Div. 2) D. Taxes 歌德巴赫猜想

    题目链接:Taxes D. Taxes time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  6. Taxes

    Taxes can be one of the largest cash outflows that a firm experiences.The size of the tax bill(税单) i ...

  7. The finnacial statements,taxes and cash flow

    This chapter-2 we learn about the the financial statements(财务报表),taxes and cash flow.We must pay par ...

  8. 经典面试题SALES TAXES思路分析和源码分享

    题目: SALES TAXES Basic sales tax is applicable at a rate of 10% on all goods, except books, food, and ...

  9. Codeforces735D Taxes 2016-12-13 12:14 56人阅读 评论(0) 收藏

    D. Taxes time limit per test 2 seconds memory limit per test 256 megabytes input standard input outp ...

随机推荐

  1. jQuery(四)--HTTP请求

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  2. 我所用过的nginx的功能

    前言 当我们提起集群时,一般所用的插件就是nginx.nginx功能如今越来越完善.第三方模块也多如牛毛,在此,总结一下不牵扯第三方模块所具有的功能. 基本功能 反向代理 负载均衡 HTTP服务器(动 ...

  3. java服务端项目开发规范

    更新内容 2015-03-13 (请先更新svn的mybatis.xml.BaseMapper.java.Pager.java文件) 加入测试类规范 加入事物控制规范 加入mapper接口规则 ...

  4. unity独立游戏开发日志2018/09/22

    f::很头痛之前rm做的游戏在新电脑工程打不开了...只能另起炉灶... 还不知道新游戏叫什么名...暂且叫方块世界.(素材已经授权) 首先是规划下场景和素材文件夹的建立. unity常用的文件夹有: ...

  5. Python3爬虫(十) 数据存储之非关系型数据库MongoDB

    Infi-chu: http://www.cnblogs.com/Infi-chu/ 一.非关系型数据库NoSQL全程是Not Only SQL,非关系型数据库.NoSQL是基于键值对的,不需要经过S ...

  6. 【EXCEL】SUMIF(条件を指定して数値を合計する)

    Mirocrosoft Excel

  7. Python的类(二)

    一.类的重写 对于父类的方法,只要它不符合子类模拟的实物的行为,都可对其进行重写.为此,可在子类中定义一个这样的方法,即它与要重写的父类方法同名.这样, Python将不会考虑这个父类方法,而只关注你 ...

  8. Use Matlab though C++

    0. Environment Windows 8.1 Pro x64 Matlab R2013a 32-bit (installed in "F:\ProgramFiles_x86\MATL ...

  9. rails 中 preload、includes、Eager load、Joins 的区别

    Rails 提供了四种不同加载关联数据的方法.下面就来介绍一下. 一.Preload Preload 是以附加一条查询语句来加载关联数据的 User.preload(:posts).to_a # =& ...

  10. 【多校联合】(HDU6095)Rikka with Competition

    题意:给定$n$个数,代表$n$个选手的能量高低,现在再给一个$k$,任意在$n$个选手中挑取两个选手比赛,如果$|a_i−a_j|>K$,那么能量高的选手获胜,另一个将被淘汰,否则两个人都有机 ...