D. On Sum of Fractions Let's assume that v(n) is the largest prime number, that does not exceed n; u(n) is the smallest prime number strictly greater than n. Find . Input The first line contains integer t (1 ≤ t ≤ 500) — the number of testscases. Eac…
Problem  Codeforces Round #556 (Div. 2) - D. Three Religions Time Limit: 1000 mSec Problem Description Input Output Sample Input 51 2 1 2 1 Sample Output 1 1 1 2 2 题解:这个题有做慢了,这种题做慢了和没做出来区别不大... 读题的时候脑子里还意识到素数除了2都是奇数,读完之后就脑子里就只剩欧拉筛了,贪心地构造使得前缀和是连续的素数,那…
这次运气比较好,做出两题.本来是冲着第3题可以cdq分治做的,却没想出来,明天再想好了. A. On Number of Decompositions into Multipliers 题意:n个数a1,a2, a3...an求n个数相乘与a1*a2*a3*a4...an相等的排列个数. 分析:首先应该对ai分解质因数,求出所有ai中质因数及个数,枚举排列中每个数包含的质因数个数,例如质因数qi,有ni个,相应的排列中数包含质因数qi个数设为x1,x2,....xn, x1+x2+x3..+xn…
Let's assume that v(n) is the largest prime number, that does not exceed n; u(n) is the smallest prime number strictly greater than n. Find . Input The first line contains integer t (1 ≤ t ≤ 500) — the number of testscases. Each of the following t li…
B. Modulo Sum Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/577/problem/B Description You are given a sequence of numbers a1, a2, ..., an, and a number m. Check if it is possible to choose a non-empty subsequence aij such…
E. Product Sum 题目连接: http://www.codeforces.com/contest/631/problem/E Description Blake is the boss of Kris, however, this doesn't spoil their friendship. They often gather at the bar to talk about intriguing problems about maximising some values. Thi…
 传送门 Description Little Chris is very keen on his toy blocks. His teacher, however, wants Chris to solve more problems, so he decided to play a trick on Chris. There are exactly s blocks in Chris's set, each block has a unique number from 1 to s. Chr…
题目链接: 题目 D. Toy Sum time limit per test:1 second memory limit per test:256 megabytes 问题描述 Little Chris is very keen on his toy blocks. His teacher, however, wants Chris to solve more problems, so he decided to play a trick on Chris. There are exactly…
题目:http://codeforces.com/contest/397/problem/B 题意:给一个n ,求能不能在[l, r]的区间内的数字相加得到, 数字可多次重复.. 比赛的时候没有想出来,看见这么大的数应该知道是思维题,比赛的时候还想会不会是背包什么的 其实数据有10^9,逗了.... k*[l, r]的范围是[k*l, k*r]; 所以只需要求n是不是在 [k*l , k*r]的范围内就行了 代码: #include <iostream> #include <cstdio…
A. On Number of Decompositions into Multipliers 题目连接:http://codeforces.com/contest/396/problem/A 大意:给定n(n<=500)个数ai(1<=ai<=10^9),得到他们的乘积m,问将m分解成n个数相乘,有多少种方法. 思路:显然每个质因数都是独立的,如果质因数pi出现了ci次,那么把它分到n个数中,就有C(ci+n-1,n-1)种方法,然后把所有因数的答案相乘就是结果.于是我们可以先预处理出…