最长公共子序列 //最长公共子序列(个数) #include<iostream> using namespace std; int c[100][100]={0}; int len1,len2; int gcd(string a,string b){ len1=a.length(); len2=b. ...
分类:
其他好文 时间:
2019-02-09 12:03:10
阅读次数:
155
Given two positive integers a and b, we can easily calculate the greatest common divisor (GCD) and the least common multiple (LCM) of a and b. But wha ...
分类:
其他好文 时间:
2019-02-09 12:00:20
阅读次数:
204
GT and numbers Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2772 Accepted Submission(s): 688 P ...
分类:
其他好文 时间:
2019-02-09 01:05:53
阅读次数:
177
题解: 一道很套路的题目 首先一个结论 $\phi(xy)=\frac{\phi(x)*\phi(y)*gcd(x,y)}{\phi(gcd(x,y))}$ 这个按照$\phi$的定义很容易知道 ...
分类:
其他好文 时间:
2019-02-08 23:25:26
阅读次数:
215
说什么呢,还是自己菜啊 【打表】C. Meaningless Operations 题目大意 求$f(a) = \max_{0 < b < a}{gcd(a \oplus b, a \> \& \> b)}.$ $2 \le a_i \le 2^{25} - 1$ 题目分析 题挺有意思的。其中对于$ ...
分类:
其他好文 时间:
2019-02-08 21:26:44
阅读次数:
197
给定一个n*n*n的立方体(中心点为原点O),选择尽量多的点,使得对于任意两点A,B,B不在线段OA上。 可以发现,原问题可转化为三维坐标下的点(x,y,z)中有多少个点的gcd(x,y,z)=1。 这道题我一开始想用欧拉函数做,但我发现需要求出1-n中与每个整数x互质的数的个数,于是试图修改一下欧 ...
分类:
其他好文 时间:
2019-02-08 19:54:51
阅读次数:
174
题意: 输入q,然后输入q个a,对于每个a,找到一个b,使gcd(a ^ b, a & b)最大,输出这个最大的gcd; 思路: 用k表示a二进制最高位的二进制编号,1,2,4,8对应1,2,3,4; 假如a不是 (1 << k) - 1这种形式的,那么总能找到一个b使a ^ b == (1 << ...
分类:
其他好文 时间:
2019-02-08 11:55:47
阅读次数:
164
【链接】 "我是链接,点我呀:)" 【题意】 给你一个a 让你从1..a 1的范围中选择一个b 使得gcd(a^b,a&b)的值最大 【题解】 显然如果a的二进制中有0的话。 那么我们就让选择的b的二进制中对应的位置为1 剩下全为0就好 这样a的二进制全都变成1之后就是答案了(gcd的右边是0)。 ...
分类:
其他好文 时间:
2019-02-08 10:19:34
阅读次数:
282
题目简述:给定长度为$n \leq 5\times 10^4$的序列$a_1, a_2, \dots, a_n$。将$\gcd(a_l, a_{l+1}, \dots, a_r) (1 \leq l \leq r \leq n) $从小到大排序后得到长度为$n(n+1)/2$的序列$b$。将$b_l ...
分类:
其他好文 时间:
2019-02-08 01:02:24
阅读次数:
224