码迷,mamicode.com
首页 >  
搜索关键字:poj 1753 枚举    ( 34864个结果
poj 3977 Subset 枚举+二分
首先分成一半2^17和2^18,并且把其中一半变成相反数,然后枚举一半二分查找另一半,在找到的位置前后也找找。 这里用到了二级排序,有很多细节要处理,不多说了。 巨坑的一个地方就是,不能用系统的abs,要自己手写,简直坑死。。 #include #include #include #include using namespace std; typedef long long ...
分类:其他好文   时间:2014-05-22 12:01:31    阅读次数:220
POJ 3070 Fibonacci
Sol:就是求第N项的斐波那契数。矩阵乘法+快速幂 #include #include #include #include using namespace std; #define LL long long struct Mat{ LL f[2][2]; }; LL MOD = 10000; Mat mul(Mat a,Mat b) { LL i,j,k...
分类:其他好文   时间:2014-05-22 10:46:35    阅读次数:191
POJ 3069 Saruman's Army
Saruman's Army Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 3519   Accepted: 1787 Description Saruman the White must lead his army along a straight path...
分类:其他好文   时间:2014-05-22 10:09:49    阅读次数:271
计算4000000000以内最大的f(n)=n的值---字符串问题python实现(五)
问题:写一个函数,计算4 000 000 000 以内的最大的那个f(n)=n的值,函数f的功能是统计所有0到n之间所有含有数字1的数字和。比如:f(13)= 6,因为“1”在“1,2,3,4,5,6,7,8,9,10,11,12,13”中的总数是6(1,10,11,12,13)。传统枚举方法效率低、求解时间长,本文介绍如何采样剪枝操作提高算法效率、降低求解时间。...
分类:编程语言   时间:2014-05-22 09:10:59    阅读次数:336
hdu 3832 Earth Hour
http://acm.hdu.edu.cn/showproblem.php?pid=3832 大致题意:给出n个灯的位置以及每个灯照亮的范围。问最后至多可以熄灭多少盏灯使得编号为1,2,3的点连通。 思路:若任意两灯的照亮范围相交,那么两点之间建边,权值为1。最后枚举一点使它到1,2,3点的距离最近,那么该距离之和+1(还有该点本身)代表必须不能熄灭的灯,那么熄灭的灯数就求出来...
分类:其他好文   时间:2014-05-22 08:46:23    阅读次数:229
poj 2411 Mondriaan's Dream(转态压缩)
题目链接:poj 2411 Mondriaan's Dream 题目大意:用1?2的木块填满n?m的矩阵有多少种方法。 解题思路:插头dp裸题。uva11270 #include #include typedef long long ll; const int N = 13; int n, m; ll set, dp[N+5][(15]; void solve (int d,...
分类:其他好文   时间:2014-05-22 08:06:07    阅读次数:177
POJ 3253 Fence Repair
Fence Repair Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 24153   Accepted: 7703 Description Farmer John wants to repair a small length of the fence aroun...
分类:其他好文   时间:2014-05-22 07:55:44    阅读次数:255
POJ 1979 Red and Black
Red and Black Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 21482   Accepted: 11488 Description There is a rectangular room, covered with square tiles. Eac...
分类:其他好文   时间:2014-05-22 07:09:25    阅读次数:237
POJ 2431 Expedition
ExpeditionTime Limit:  1000MSMemory Limit:  65536KDescriptionA group of cows grabbed a truck and ventured on an expedition deep into the jungle. Being rather poor drivers, the cows unfortunately manag...
分类:其他好文   时间:2014-05-22 06:16:01    阅读次数:423
UVA 12123 - Magnetic Train Tracks(计数问题)
题目链接:12123 - Magnetic Train Tracks 题意:给定n个点,求有几个锐角三角形。 思路:和UVA 11529是同类的题,枚举一个做原点,然后剩下点根据这个原点进行极角排序,然后利用two pointer去遍历一遍,找出角度小于90度的锐角,然后扣掉这些得到钝角三角形的个数,然后在用总情况去扣掉钝角就是锐角或直角 代码: #include #include #...
分类:Web程序   时间:2014-05-20 14:10:56    阅读次数:412
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!