码迷,mamicode.com
首页 >  
搜索关键字:max sum plus plus    ( 46271个结果
UVA 1510 Neon Sign(计数)
UVA 1510 题目链接 题意:给定一些点两两相连,已知每两点连接是红色还是蓝色,问同色三角形有多少个 思路:由于不同色三角形也有两边同色,直接考虑不好考虑,反过来考虑,先找出不同色三角形,对于每个点而言,找一个红边和一个蓝边就能构成不同色三角形,那么每个三角形被选了3次,其中一次是同色的不用考虑,所以最后答案除以2,然后在用总情况数C(n, 3) - sum即可 代码:...
分类:其他好文   时间:2014-07-28 00:13:00    阅读次数:495
URAL - 1057 Amount of Degrees
Description Create a code to determine the amount of integers, lying in the set [ X; Y] and being a sum of exactly K different integer degrees of B. Example. Let X=15, Y=20, K=2, B=2. By...
分类:其他好文   时间:2014-07-28 00:09:39    阅读次数:347
hdu 1085 Holding Bin-Laden Captive!(母函数)
http://acm.hdu.edu.cn/showproblem.php?pid=1085 题意:1元,2元,5元的硬币分别有num[1],num[2],num[3]个。问用这些硬币不能组合成的最小钱数。 继续母函数。 有两个注意的地方: 对c2[]初始化的同时也要对c1[]初始化。 最后枚举到sum+1,因为存在[1,sum]都可以凑成的可能,这时输出sum+1。 ...
分类:其他好文   时间:2014-07-27 23:56:49    阅读次数:359
hdu 1850 Being a Good Boy in Spring Festival
我们知道在Nim博弈中 如果我们面对的是一个非奇异局势(a,b,c),要如何变为奇异局势呢?假设 a b)=(a(+)a)(+)(b(+)b)=0(+)0=0。要将c 变为a(+)b,只要从 c中减去 c-( a(+)b)即可。   也就是说,其中一个堆C必须大于所有其他所有堆异或的值,由此我们可以进行枚举 即(sum^a[i])#include int main()...
分类:编程语言   时间:2014-07-27 23:38:10    阅读次数:245
UVa 10742 - The New Rule in Euphomia
题目:给你一个数,问有多少对素数的和小于这个数。 分析:数论。利用素数表枚举求解。             1.打表计算1000000内的素数(筛法);             2.对于每个输入的数字 v,枚举他的所有拆分情况;                设F(i)是不超过数字 i 的素数的个数,S(v)为 v 的拆分种数,则:                 S(v)= sum(m...
分类:其他好文   时间:2014-07-27 23:37:49    阅读次数:245
UVA 10608
并查集简单题#include #include using namespace std;#define max 30010int f[max];int getf(int k){ while(k!=f[k]){ k=f[k]; } return k;}void combine(int a,int b)...
分类:其他好文   时间:2014-07-27 23:31:09    阅读次数:193
CodeForces 237C
素数打表,加上sum[i]数组表示1-i中有多少个素数二分查找#include #include using namespace std;#define max 1000005int phi[max],sum[max];int a,b,k;void getp(){ for(int i=2;i>a>>...
分类:其他好文   时间:2014-07-27 23:27:19    阅读次数:355
FZU 1901
#include #include 考查了对next数组的了解using namespace std;#define max 1000005int next[max],l,ans[max];char s[max];void getNext(){ int j,k; next[0]=-1; j=0;k=...
分类:其他好文   时间:2014-07-27 23:26:49    阅读次数:174
LeetCode: Max Points on a Line
LeetCode: Max Points on a LineGiven n points on a 2D plane, find the maximum number of points that lie on the same straight line.地址:https://oj.leetcod...
分类:其他好文   时间:2014-07-27 23:22:59    阅读次数:289
自定义View--day1
public class MyVolumnView extends View { int count_dark = 7; final int MAX_COUNT = 15; Paint paint; Bitmap dark; Bitmap light; final...
分类:其他好文   时间:2014-07-27 23:20:29    阅读次数:261
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!