/** 题目:Irrelevant Elements UVA - 1635 链接:https://vjudge.net/problem/UVA-1635 题意:給定n,m;題意抽象成(a+b)^(n-1)按照二次项分布后每个系数的值按照位置分别为c1,c2,c3...: 如果ci%m==0; 那么输出这个位置. 思路:已知n,计算系数的方法:c(n,m) = (n-m+1)/m*c(n,m-1) ;由于c(n,m-1)%m不一定等于0.所以要先乘. 由于n达到了1e5,所以如果算结果是不可行的.…
vjudge链接 原题链接 乍一看似乎没什么思路,但是写几个简单的例子之后规律就变得很明显. 比如当 n=5 时,每一步计算后的结果如下: a1 a1+a2 a1+2a2+a3 a1+3a2+3a3+a4 a1+4a2+6a3+4a4+a5 显然系数"1, 4, 6, 4, 1"就是杨辉三角第五行. 故某一项的系数是否是题中 m 的倍数,就决定了最终得到的数除以 n 的余数和那一项是否有关. 二项式定理: 从中很容易得到前后两项的关系 C(n, k)=(n-k+1)/k*C(n, k-…
GCD and LCM Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 3409    Accepted Submission(s): 1503 Problem Description Given two positive integers G and L, could you tell me how many solutions of…
Deciphering Password Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2357    Accepted Submission(s): 670 Problem Description Xiaoming has just come up with a new way for encryption, by calculati…
Divisors 题目链接(点击) Your task in this problem is to determine the number of divisors of Cnk. Just for fun -- or do you need any special reason for such a useful computation? Input The input consists of several instances. Each instance consists of a sin…
注意要开long long 如果int * int会炸 那么久改成long long * int #include<cstdio> #include<vector> #include<cstring> #define REP(i, a, b) for(int i = (a); i < (b); i++) using namespace std; typedef long long ll; const int MAXN = 1123456; bool is_prim…
题目大意: 有一个数n,满足lcm(i,j)==n并且i<=j时,(i,j)有多少种情况? 解题思路: n可以表示为:n=p1^x1*p2^x1.....pk^xk. 假设lcm(a,b) == n: a = p1^c1 * p2^c2 ..... pk^ck. b = p1^e1 * p2^e2 .... pk^ek. xi = max(ci, ei). 对于有序数对(a,b),有唯一分解定理知,每一个素因数的幂都决定了一个独一无二的数. 求(a,b)的种数就可以转化为求(ci,ei)的种数:…
https://vjudge.net/problem/UVA-10791 题意: 输入整数n,求至少两个正整数,使得它们的最小公倍数为n,且这些整数的和最小. 思路: 首先对n进行质因数分解,举个例子来说,12=2×2×3,最小和为7,也就是4和3,相同质因子必须放在一起,也就是说这里的2个2必须合在一起变成4,不然2和3会有更小的公倍数6. #include <iostream> #include <cstring> #include <algorithm> #inc…
Young cryptoanalyst Georgie is investigating different schemes of generating random integer numbers ranging from 0 to m − 1. He thinks that standard random number generators are not good enough, so he has invented his own scheme that is intended to b…
Irrelevant Elements Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 2407   Accepted: 597 Case Time Limit: 2000MS Description Young cryptoanalyst Georgie is investigating different schemes of generating random integer numbers ranging from…