目大意:给你$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. java对接微信支付

    对接微信扫码支付(模式2),前端使用velocity技术 (1)调用微信支付接口(view层)  此部分业务逻辑部分可以省略 @RequestMapping("/wxpay.htm" ...

  2. zookeeper相关知识与集群搭建

    Zookeeper Zookeeper相关概念 Zookeeper概述 Zookeeper是一个分布式协调服务的开源框架,主要用来解决分布式集群中应用系统的一致性问题. Zookeeper本质上是一个 ...

  3. AB PLC 编程之状态机

    AB的程序设计和西门子有点PLC不大一样,在AB中没有RS指令,所以主要用move指令来作步进.今天我们就用Move指令写个AB的程序,和西门子比,有哪些不同. 控制任务 很简单的一个状态机.初始步为 ...

  4. Redis缓存数据库的安装与配置(2)

    1.为php安装redis客户端扩展 wget https://github.com/nicolasff/phpredis/archive/master.zip tar xf phpredis-mas ...

  5. ssh安装和使用

    1.基础知识 ssh用于远程登陆,linux默认安装了client,如果需要被登陆则需要安装 server 2.安装 apt-get install openssh-server 检查是否安装成功 a ...

  6. shell重温---基础篇(函数操作)

        linux shell 可以用户定义函数,然后在shell脚本中可以随便调用.shell中函数的定义格式如下: [ function ] funname [()] { action; [ret ...

  7. vue2018年5月报错No parser and no file path given

    mac电脑直接: rm -rf node_modules rm package-lock.json npm install npm install prettier@~1.12.1 执行完这四个命令, ...

  8. oracle 数据被修改怎么修复?(闪回)

    数据被删除 或者 update 的时候忘记勾选where 限制条件,数据全部更新了?  怎么办? 要跑路了? NO !!! 看下面,迅速帮你闪回数据! demo sql: 1. SELECT * FR ...

  9. springmvc 处理put,delete请求

    前言:ajax用post编辑,删除提示越权操作状态为500,修改半晌最后大神指点说是:type修改为post和delete模式 最后还是一知半解,但是程序却正常使用了.当然注意我用的mvc,contr ...

  10. 从C到C++ (2)

    从C到C++ (2) 一.    C++中增加了作用域标示符 :: 1.     用于对局部变量同名的全局变量进行访问. 2.     用于表示类成员. 二.    new.delete运算符 1.  ...