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…
http://poj.org/problem?id=1142 题意: 给出一个数n,求大于n的最小数,它满足各位数相加等于该数分解质因数的各位相加. 思路:直接暴力. #include <iostream> #include <cstring> #include <algorithm> #include <vector> #include <queue> #include <cmath> using namespace std; in…
题目链接:http://poj.org/problem?id=1845 关于质因数分解,模板见:http://www.cnblogs.com/atmacmer/p/5285810.html 二分法思想:选定一个要进行比较的目标,在区间[l,r]之间不断二分,直到取到与目标相等的值. #include<iostream> #include<cstdio> #include<cstring> using namespace std; typedef long long ll…
                               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…
GCD & LCM Inverse Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 16206   Accepted: 3008 Description Given two positive integers a and b, we can easily calculate the greatest common divisor (GCD) and the least common multiple (LCM) of a…
题目:  http://poj.org/problem?id=3714 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=27048#problem/D Raid Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 7355   Accepted: 2185 Description After successive failures in the battles aga…
一.Description The most important part of a GSM network is so called Base Transceiver Station (BTS). These transceivers form the areas called cells (this term gave the name to the cellular phone) and every phone connects to the BTS with the strongest…