HDU4811 Ball 2013ACM/ICPC亚洲区南京站现场赛 (模拟乱搞)
来源:互联网 发布:king of the hill知乎 编辑:程序博客网 时间:2024/04/28 19:02
Ball
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2344 Accepted Submission(s): 983
Problem Description
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 these balls in any order on the table, one after another. Each time Jenny places a new ball on the table, he may insert it somewhere in the middle (or at one end) of the already-placed row of balls.
Additionally, each time Jenny places a ball on the table, he scores some points (possibly zero). The number of points is calculated as follows:
1.For the first ball being placed on the table, he scores 0 point.
2.If he places the ball at one end of the row, the number of points he scores equals to the number of different colors of the already-placed balls (i.e. expect the current one) on the table.
3.If he places the ball between two balls, the number of points he scores equals to the number of different colors of the balls before the currently placed ball, plus the number of different colors of the balls after the current one.
What’s the maximal total number of points that Jenny can earn by placing the balls on the table?
Input
There are several test cases, please process till EOF.
Each test case contains only one line with 3 integers R, Y and B, separated by single spaces. All numbers in input are non-negative and won’t exceed 109.
Output
For each test case, print the answer in one line.
Sample Input
2 2 2
3 3 3
4 4 4
Sample Output
15
33
51
Source
2013ACM/ICPC亚洲区南京站现场赛——题目重现
就是模拟。。放三种颜色的球球。乱搞就可以过
#include "cstring"#include "cstdio"#include "string.h"#include "iostream"#include "algorithm"using namespace std;int main(){ long long r,y,b; long long base[3][3][3]; base[0][0][0]=0;base[0][0][1]=0;base[0][0][2]=1;base[0][1][1]=1;base[0][1][2]=3; base[0][2][2]=6;base[1][1][1]=3;base[1][1][2]=6;base[1][2][2]=10;base[2][2][2]=15; long long a[5]; memset(a,0,sizeof(a)); while(~scanf("%lld%lld%lld",&a[0],&a[1],&a[2])) { long long ans=0; long long cnt=0; for(int i=0;i<=2;i++) { if(a[i]>2) { cnt+=a[i]-2; a[i]=2; } } long long temp=a[0]+a[1]+a[2]; sort(a,a+3); ans+=base[a[0]][a[1]][a[2]]; ans+=cnt*temp; printf("%lld\n",ans); }}
- HDU4811 Ball 2013ACM/ICPC亚洲区南京站现场赛 (模拟乱搞)
- 2013ACM/ICPC亚洲区南京站现场赛
- 2013ACM/ICPC亚洲区南京站现场赛——题目重现
- HDU 4810 Wall Painting(组合数学 + 位运算)——2013ACM/ICPC亚洲区南京站现场赛
- 2013ACM/ICPC亚洲区南京站现场赛 HDU 4802 && HDU 4803 && HDU 4811 && HDU 4812
- 2013ACM/ICPC亚洲区南京站现场赛——题目重现 (HDU 4810) 二进制思想
- HDU5950 2016ACM/ICPC亚洲区沈阳站现场赛
- 2013ACM/ICPC亚洲区成都站现场赛——题目重现
- 2017ICPC/ACM亚洲赛区西安站现场赛 总结
- 2014ACM/ICPC亚洲区鞍山赛区现场赛 题解
- 2016ACM/ICPC亚洲区北京站现场赛直播地址
- 2016 ACM-ICPC 亚洲区(青岛赛区)现场赛
- 2013ACM/ICPC亚洲区杭州站现场赛——题目重现Zhuge Liang's Password
- 2014ACM/ICPC亚洲区西安站现场赛 F color(转换角度+容斥)
- hdu 5510 Bazinga 2015ACM/ICPC亚洲区沈阳站现场赛
- hdu5521 Meeting 最短路 2015ACM/ICPC亚洲区沈阳站现场赛
- 2016ACM/ICPC亚洲区沈阳站现场赛题解报告
- 2016ACM/ICPC亚洲区大连站现场赛题解报告
- 算法---6.堆排序
- 算法---7.归并排序
- jaspersoft导出word、excel的一点点总结
- 二进制权限
- 算法---8.基数排序
- HDU4811 Ball 2013ACM/ICPC亚洲区南京站现场赛 (模拟乱搞)
- 【u233】单词化简
- java中volatile关键字的含义
- Android NDK中开发中字符串的处理
- python 倒序输出字符串,列表
- javascript中的UI事件 — 第13.4.1节
- 微信小程序带来的价值和机遇
- sleep()和wait()的区别
- mfc函数