码迷,mamicode.com
首页 >  
搜索关键字:spoj balnum balanced    ( 1777个结果
SPOJ Problem 7424:Girls and Boys
已知男生和女生的人数,将男生和女生互相穿插,要求当连续的同性别人数最少时最多的同性别连续人数。论bool()的妙用。。#include#define max(a,b)a>b?a:bint x,y,s;int main(){ while(scanf("%d%d",&x,&y)&&(x+y!=-2...
分类:其他好文   时间:2015-03-07 11:17:09    阅读次数:123
SPOJ Problem 2727:Army Strength
题目在此 http://www.spoj.com/problems/ARMY/总体来说就是求最大值。。#include#includeint x,n,t,i,a,b;int max,pos;int main(){ scanf("%d",&t); while(t--){ sc...
分类:其他好文   时间:2015-03-07 09:02:25    阅读次数:176
SPOJ Problem 3375:Stamps
题目大意:你需要一拖邮票,你有一坨的朋友可以给你邮票,问最少要多少个朋友才能弄到邮票。#include#include#include#includeusing namespace std;bool comp(int x,int y){return x>y;}int n,m,i,j,t,s;int ...
分类:其他好文   时间:2015-03-06 22:11:08    阅读次数:185
SPOJ Problem 9948:Will it ever stop
如题。。http://www.spoj.com/problems/WILLITST/#includelong long n;int main(){ scanf("%lld",&n); while(n>1){ if (n==3||n==6){printf("NIE\n");r...
分类:其他好文   时间:2015-03-06 22:01:34    阅读次数:266
SPOJ Problem 1724:Counting Triangles
题目大意:数三角形。。数据范围是一百万,而且暴力不可行,所以要推公式。公式可以参照http://www.docin.com/p-720073077.html#includeint t; long long n,m,ans;int main(){ scanf("%d",&t); while...
分类:其他好文   时间:2015-03-06 22:00:24    阅读次数:153
SPOJ Problem 379:Ambiguous Permutations
http://www.spoj.com/problems/PERMUT2/如题。。#include#includeint n,i,j;int a[100005];int main(){ while(scanf("%d",&n)&&n){ for (i=1;i<=n;i++){ ...
分类:其他好文   时间:2015-03-06 20:39:23    阅读次数:154
Convert Sorted Array to Binary Search Tree
Convert Sorted Array to Binary Search Tree问题:Given an array where elements are sorted in ascending order, convert it to a height balanced BST.思路: 递归,....
分类:其他好文   时间:2015-03-06 18:29:42    阅读次数:131
March 3rd 2015 <11:31>
spoj 1167 http://www.spoj.com/problems/MINCOUNT/一个高度为h的正立三角形,由硬币拼成,现在把这个三角形通过一动硬币位置变成倒立等大的三角形,求最少移动硬币数。其实也就是求正立与倒立两个三角形最小不重叠部分,列几个例子我发现,重叠部分最大是三分之二,即不...
分类:其他好文   时间:2015-03-06 12:20:51    阅读次数:128
Spring-2-H Array Diversity(SPOJ AMR11H)解题报告及测试数据
Array DiversityTime Limit:404MS Memory Limit:0KB 64bit IO Format:%lld & %lluDescriptionHere we go!Let's define the diversity of a list of numbers to b...
分类:编程语言   时间:2015-03-06 00:59:46    阅读次数:316
SPOJ Problem 394:Alphacode
给一组数字,按a..z为1..26排求出能组成多少种不同的字母链。简单的DP,边界条件f[0]=1,f[1]=1,f[n]=f[n-1](如果第n个字符即s[n-1]!=48),f[n]+=f[n-2](如果第n和第n-1个字符能组成小于26的数字)#include#includechar s[50...
分类:其他好文   时间:2015-03-05 22:14:03    阅读次数:134
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!