WUSTOJ 1285: Factors(Java)】的更多相关文章

1285: Factors 参考   hadis_fukan的博客--wustoj 1285 Factors 题目   输入一个数n,找出1~n之间(包括1,n)的质因子最多的数(x)的质因子个数(f[x]).更多内容点击标题. 分析   很明显,这题的结果是可以直接算出来的,保存到数组中.通过题目,就可以了解到,我们需要算出2-2000000之间所有的数的质因子的个数.这样才能找出1~n之间质因子最多的数x.这里你可能想是不是需要先将质数单独求出来.那是完全没必要的.我们只需要在求因子的过程中…
题目链接:1319: 球 参考:wustoj 1319 球-wust_tanyao,并查集 并查集系列:WUSTOJ 1346: DARK SOULS(Java)并查集 Description Icy is a lonely boy. He was so boring these days. So he started to play a game himself. First, he took a heap of balls with many different colors. ( One…
1283: Hamster 参考博客 wust_tanyao的博客 题目   第0个月有1对仓鼠.仓鼠的寿命是M个月,仓鼠成年后每个月生一对仓鼠(一雌一雄),问N个月后有仓鼠多少对.更多内容点此链接 题目分析   阅读之前先看看两组数据,如果能推出结果,可以跳过题目分析部分.   输入: 3 4 5 2   输出: 3 4   OK,如果你推算不出来,可以参考下面这个表的推算过程:   代码中只用了第一个参数(birth[])和第三个参数(adult).其他参数可直接算出来.递推语句是: bir…
题目链接:1326: Graph 参考博客:HNUSTOJ-1617 Graph(费马数)--G2MI Description Your task is to judge whether a regular polygon can be drawn only by straightedge and compass. The length of the straightedge is infinite. The width of the compass is infinite. The strai…
题目链接:1332: Prime Factors Description I'll give you a number , please tell me how many different prime factors in this number. Input There is multiple test cases , in each test case there is only one line contains a number N(2<=N<=100000). Process to…
题目链接:1349: TLE Description WH在刷题时,设计出了如下代码: #include<stdio.h> int main() { int i, j, cnt, k, N, K, a[5555]; scanf("%d%d", &N, &K); int ans = 0; for (i = 1; i <= N; i++) { scanf("%d", &a[i]); // 输入N个数 } for (i = 1;…
1282: Start 题目   判断一个字符串是不是回文串.例如:"abcba"是回文串.更多内容点击标题. 分析   水题,自己思考. 代码 /** * time 838ms * @author PengHao * @version A1.0 * @date 2019-04-23 下午12:44:50 */ import java.io.BufferedInputStream; import java.util.Scanner; public class Main { public…
题目链接:1347: GCD Description 已知gcd(a,b)表示a,b的最大公约数. 现在给你一个整数n,你的任务是在区间[1,n)里面找到一个最大的x,使得gcd(x,n)等于1. Input 输入文件的第一行是一个正整数T,表示有T组测试数据 接下来有T行,每行有一个正整数n (1<=n<=10^1000). Output 每组测试输出要求x. Sample Input 7 1 2 15 100 2315 10000000000000000000000000000000000…
题目链接:1325: Distance Description There is a battle field. It is a square with the side length 100 miles, and unfortunately we have two comrades who get hurt still in the battle field. They are in different positions. You have to save them. Now I give…