http://poj.org/problem?id=1142 题意: 给出一个数n,求大于n的最小数,它满足各位数相加等于该数分解质因数的各位相加. 思路:直接暴力. #include <iostream> #include <cstring> #include <algorithm> #include <vector> #include <queue> #include <cmath> using namespace std; in…
Description 题目描述 While skimming his phone directory in 1982, Albert Wilansky, a mathematician of Lehigh University, noticed that the telephone number of his brother-in-law H. Smith had the following peculiar property: The sum of the digits of that nu…
Description While skimming his phone directory in 1982, Albert Wilansky, a mathematician of Lehigh University,noticed that the telephone number of his brother-in-law H. Smith had the following peculiar property: The sum of the digits of that number w…
                               Smith Numbers Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 14521   Accepted: 4906 Description While skimming his phone directory in 1982, Albert Wilansky, a mathematician of Lehigh University,noticed tha…
题意:给定一个N,求一个大于N的最小的Smith Numbers,Smith Numbers是一个合数,且分解质因数之后上质因子每一位上的数字之和 等于 其本身每一位数字之和(别的博客偷的题意) 思路:主要是分治:分解成质因子使用递归即可. #include<cstdio> #include<cmath> // 检测素数 bool is_prime(int n) { ; i*i <= n;++i) ){ ; } ; } //数位 int sumfun(int n) { ; ;…
Smith Numbers Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 14173   Accepted: 4838 Description While skimming his phone directory in 1982, Albert Wilansky, a mathematician of Lehigh University,noticed that the telephone number of his b…
                                                         id=1730">Perfect Pth Powers Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 16746   Accepted: 3799 Description We say that x is a perfect square if, for some integer b, x = b2.…
While skimming his phone directory in 1982, Albert Wilansky, a mathematician of Lehigh University,noticed that the telephone number of his brother-in-law H. Smith had the following peculiar property: The sum of the digits of that number was equal to…
Prime Test Time Limit: 6000MS   Memory Limit: 65536K Total Submissions: 35528   Accepted: 9479 Case Time Limit: 4000MS Description Given a big integer number, you are required to find out whether it's a prime number. Input The first line contains the…
例5    分解质因数 题目描述 将一个正整数分解质因数.例如:输入90,输出 90=2*3*3*5. 输入 输入数据包含多行,每行是一个正整数n (1<n <100000) . 输出 对于每个整数n将其分解质因数. 输入样例 90 256 199 输出样例 90=2*3*3*5 256=2*2*2*2*2*2*2*2 199=199 (1)编程思路. 对整数n进行分解质因数,应让变量i等于最小的质数2,然后按下述步骤完成: 1)如果i恰等于n,则说明分解质因数的过程已经结束,输出即可. 2)…