题解报告:hdu 1406 完数】的更多相关文章

http://acm.hdu.edu.cn/showproblem.php?pid=1406 完数的定义:如果一个大于1的正整数的所有因子之和等于它的本身,则称这个数是完数,比如6,28都是完数:6=1+2+3:28=1+2+4+7+14. 本题的任务是判断两个正整数之间完数的个数. 今天做的这题也是昨天的那题同样的思想,用类似筛选素数的方法计算因子的和. #include<cstdio> const int MAXN=10000+2; const int N=MAXN>>1; i…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1406 Problem Description 完数的定义:如果一个大于1的正整数的所有因子之和等于它的本身,则称这个数是完数,比如6,28都是完数:6=1+2+3:28=1+2+4+7+14.本题的任务是判断两个正整数之间完数的个数. Input 输入数据包含多行,第一行是一个正整数n,表示测试实例的个数,然后就是n个测试实例,每个实例占一行,由两个正整数num1和num2组成,(1<num1,nu…
Problem Description 完数的定义:如果一个大于1的正整数的所有因子之和等于它的本身,则称这个数是完数,比如6,28都是完数:6=1+2+3:28=1+2+4+7+14. 本题的任务是判断两个正整数之间完数的个数. Input 输入数据包含多行,第一行是一个正整数n,表示测试实例的个数,然后就是n个测试实例,每个实例占一行,由两个正整数num1和num2组成,(1 import java.util.Scanner; public class Main{ public static…
完数 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 23233    Accepted Submission(s): 8456 Problem Description 完数的定义:如果一个大于1的正整数的所有因子之和等于它的本身,则称这个数是完数,比如6,28都是完数:6=1+2+3:28=1+2+4+7+14. 本题的任务是判断两个正…
注意:num1和num2的大小未知,需比较! 有两种方法: 法一:素数打印+素数分解(求因数和公式) #include<iostream> #include<cstring> #include<cstdio> #include<string> #include<cmath> #include<algorithm> using namespace std; ];//记录包括自身的完数个数 ]; int prime[1229+1];//如…
http://acm.hdu.edu.cn/showproblem.php?pid=1406 完数 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 15365    Accepted Submission(s): 5592 Problem Description 完数的定义:如果一个大于1的正整数的所有因子之和等于它的本身,则称这个数是…
Problem Description "Well, it seems the first problem is too easy. I will let you know how foolish you are later." feng5166 says."The second problem is, given an positive integer N, we define an equation like this:  N=a[1]+a[2]+a[3]+...+a[m…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2069 Problem Description Suppose there are 5 types of coins: 50-cent, 25-cent, 10-cent, 5-cent, and 1-cent. We want to make changes with these coins for a given amount of money.For example, if we have 11…
Problem Description People in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (=17^2), i.e., 1-credit coins, 4-credit coins, 9-credit coins, ...…
CF Educational Round 78 (Div2)题解报告A~E A:Two Rival Students​ 依题意模拟即可 #include<bits/stdc++.h> using namespace std; int T; int n, x, a, b; int main() { cin >> T; while(T--) { cin >> n >> x >> a >> b; if(a > b) swap(a, b…