编程介的小学生 2019-05-19 22:18 采纳率: 20.5%
浏览 182

分解加法的过程的计算,要求运用的C语言解决的代码编写的方式的步骤是怎么实现的呢?

Problem Description
Let d(x) be the sum of all divisors of x. x is called a good number if every number from 1 to d(x) can be expressed as a sum of distinct divisors of x.

For example, 6 is a good number, d(6)=1+2+3+6=12, 4=1+3,5=2+3,7=1+6 and so on.

Teacher Mai wants to know whether a even number p can be expressed as a sum of two good numbers.

Input
There are multiple test cases(about 40000).

For each test case, there is only one line contains one even number p(1≤p≤1018).

Most test cases are generated randomly.

Output
For each test case, print "YES" or "NO" in the first line. That means if is possible to express p as a sum of two good numbers.

If your answer is "YES", print two number a,b in the second lines. Both a and b should be good numbers, and a+b=p.

In the third and the fourth line, print the factorization of number a and b. If a=∏ki=1peii, where p1<p2<⋯<pk, pi are all prime numbers and ei≥1, you should print k first, then 2k space-seperated numbers p1,e1,p2,e2,⋯,pk,ek.

Sample Input
18

Sample Output
YES
6 12
2 2 1 3 1
2 2 2 3 1

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
    • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
    • ¥15 乘性高斯噪声在深度学习网络中的应用
    • ¥15 运筹学排序问题中的在线排序
    • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
    • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
    • ¥15 C++ 头文件/宏冲突问题解决
    • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
    • ¥50 安卓adb backup备份子用户应用数据失败
    • ¥20 有人能用聚类分析帮我分析一下文本内容嘛