题意:给定一个m*n的棋盘,问最多放多少个马,使得他们不相互攻击。 析:很明显可以从上图看出来了马放在白格,或者黑格,不会攻击,不过行或者列为1,2时是特殊的,我们只要特殊判断一下就行了。 代码如下: ...
分类:
其他好文 时间:
2017-05-12 23:55:50
阅读次数:
178
Description Gappu has a very busy weekend ahead of him. Because, next weekend is Halloween, and he is planning to attend as many parties as he can. Si ...
分类:
其他好文 时间:
2017-05-12 17:31:58
阅读次数:
211
http://lightoj.com/volume_showproblem.php?problem=1341 题意:给你矩形的面积(矩形的边长都是正整数),让你求最小的边大于等于b的矩形的个数。 思路:根据唯一分解定理,把X写成若干素数相乘的形式,则X的正因数的个数为:(1+a1)(1+a2)(1+ ...
分类:
其他好文 时间:
2017-05-07 15:45:23
阅读次数:
157
http://lightoj.com/login_main.php?url=volume_showproblem.php?problem=1356 题意: 给出n个数,问最多能选几个数,使得该集合中的任意两个数中其中一个数不是另一个质数倍。 思路: 二分图的最大独立集。 那么怎么建图呢?我们按照质因 ...
分类:
其他好文 时间:
2017-05-07 11:38:03
阅读次数:
519
http://lightoj.com/login_main.php?url=volume_showproblem.php?problem=1370 题意: 给一些数Ai(第 i 个数),Ai这些数代表的是某个数欧拉函数的值,我们要求出数 Ni 的欧拉函数值不小于Ai。而我们要求的就是这些 Ni 这些 ...
分类:
其他好文 时间:
2017-05-07 10:26:08
阅读次数:
99
Gappu has a very busy weekend ahead of him. Because, next weekend is Halloween, and he is planning to attend as many parties as he can. Since it's Hal ...
分类:
其他好文 时间:
2017-04-29 09:44:16
阅读次数:
228
/* 题意: 对于每个数字a[i]找到一个数num[i],num[i]的欧拉函数值大于等于a[i], 求找到的所有数的最小和。 */ #include #include #include #include #include #include using namespace std; typedef ... ...
分类:
其他好文 时间:
2017-04-24 23:22:46
阅读次数:
276
1097 - Lucky Number Lucky numbers are defined by a variation of the well-known sieve of Eratosthenes. Beginning with the natural numbers strike out al ...
分类:
其他好文 时间:
2017-04-22 14:43:42
阅读次数:
187
1 /* 2 LightOJ1234 Harmonic Number 3 http://lightoj.com/login_main.php?url=volume_showproblem.php?problem=1234 4 打表 分块 5 由于只有加法运算,1e8时间是可以承受的。 6 然而空间无... ...
分类:
其他好文 时间:
2017-04-13 21:32:33
阅读次数:
141
题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1245 题意:求f(n)=n/1+n/2.....n/n,其中n/i保留整数 显然一眼看不出什么规律。而且n有2e31直接暴力肯定要出事情 但是f=n/x这个函数很好关于y = x ...
分类:
其他好文 时间:
2017-03-23 01:24:16
阅读次数:
155