Ball HDU - 4811】的更多相关文章

Jenny likes balls. He has some balls and he wants to arrange them in a row on the table. Each of those balls can be one of three possible colors: red, yellow, or blue. More precisely, Jenny has R red balls, Y yellow balls and B blue balls. He may put…
题目链接: 题目 Ball Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) 问题描述 Jenny likes balls. He has some balls and he wants to arrange them in a row on the table. Each of those balls can be one of three possible colors: red,…
题目链接 题意:三种颜色的球,现给定三种球的数目,每次取其中一个放到桌子上,排成一条线,每次放的位置任意,问得到的最大得分. 把一个球放在末尾得到的分数是它以前球的颜色种数 把一个球放在中间得到的分数是它前边球的颜色种数+后边的球颜色种数. 题解:由题意可知当三种颜色气球都大于等于2的时候是最好的情况,先一种颜色取两个得15分,然后把剩下的球全都放到中间即可,每次分数+6,题目中的样例就是这样的.当存在一种球的颜色小于2的时候我们分类讨论可以发现 0 1 1 和  0 0 2 的解是相同的,1…
意甲冠军: 有三种颜色的小珠,每种颜色的量R,Y,B 转球进入桌面成序,有多少种不同的颜色分别砍下的球在球门前+有多少身后球不同的颜色 问:最大的总比分值 思考: 球和后面的球先放好.剩下的就放中间了 代码: #include"cstdlib" #include"cstdio" #include"cstring" #include"cmath" #include"queue" #include"a…
题意: 给出一定数量的三种颜色的球,计算如何摆放得到值最大(有一定顺序) 有三种摆放方法 1.如果放的是第一个(桌子上原来没有),数值不变 2.如果在末尾追加一个,那么增加前面不同颜色的个数的值 3.如果在两个之间放置,那么增加两边不同颜色的个数的值 思路: b蓝 r红 y黄 三种摆放方法可以理解为两种,2和3归为一种. 寻求最大值的话,一定是每次在中间放置球,这样得到的值更大 首先,如果每个球大于2个的话,就是说可以拿出部分球摆成以下这样情况 brybry,两边都有3种颜色,剩下的球全部放在y…
http://acm.hdu.edu.cn/showproblem.php? pid=4811 由于看到ball[0]>=2 && ball[1]>=2 && ball[2]>=2  ans=(sum-6)*6+15    sum是三种颜色的球个数的和,然后就想到分类讨论,由于情况是可枚举的. 发现整数假设不加LL直接用%I64d打印会出问题 //#pragma comment(linker, "/STACK:102400000,10240000…
题意:在1到n的气球中,在不同的区域中涂颜色,问每个气球涂几次. #include<cstdio>int num[100010];int main(){ int n, x, y;; while (scanf("%d", &n), n) {  for (int i = 0; i < n; i++)  {   scanf("%d%d", &x, &y);   num[x] += 1; num[y + 1] -= 1;  }  f…
A.GPA(HDU4802): 给你一些字符串对应的权重,求加权平均,如果是N,P不计入统计 GPA Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1193    Accepted Submission(s): 743 Problem Description In college, a student may take several…
思路:线段树,区间更新 #include<iostream> #include<vector> #include<string> #include<cmath> #include<set> #include<algorithm> #include<cstdio> #include<map> #include<cstring> #include<list> #define MAXSIZE…
思路等引自博客 https://blog.csdn.net/johnwayne0317/article/details/84928568 对数组a[7]: a[0]=1; = d[0] a[1]=1; = d[1]+d[0] a[2]=1; = d[2]+d[1]+d[0] a[3]=1; .................. a[4]=1; a[5]=1; a[6]=1; a[7]=1; =   d[7]+d[6]+d[5]+d[4]+d[3]+d[2]+d[1]+d[0] 如果要对a[0]~…