2013nanjingJ
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u
System Crawler (2014-10-08)
Description
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
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 10 9.
Output
Sample Input
3 3 3
4 4 4
Sample Output
33
51
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#define M(a,b) memset(a,b,sizeof(a))
#include<map>
using namespace std; long long R,Y,B; int main()
{
while(scanf("%I64d%I64d%I64d",&R,&Y,&B)==)
{
long long ans = ;
if(R>=&&Y>=&&B>=) //全大于1
ans = (R+Y+B-)*+;
else
{
if(R==&&Y>&&B>||Y==&&R>&&B>||B==&&Y>&&R>) //一个1其余大于1
{
ans = (R+Y+B-)*+;
}
else if(R==&&Y==&&B>||B==&&Y==&&R>||R==&&B==&&Y>) //两个1一个大于1
{
ans = (R+Y+B-)*+;
}
else if(R==&&Y==&&B==) //3个1
{
ans = ;
}
else if(R==&&Y>&&B>||B==&&Y>&&R>||Y==&&B>&&R>) //1个0
{
ans = (R+Y+B-)*+;
}
else if(R==&&Y==&&B>||B==&&Y==&&R>||R==&&B==&&Y>)//2个0
{
ans = (R+B+Y-)*+;
}
else if(R==&&Y==&&B>||R==&&Y==&&B>||B==&&Y==&&R>||B==&&Y==&&R>||R==&&B==&&Y>||B==&&R==&&Y>) //1个0,1个1
{
ans = (R+B+Y-)*+;
}
else if(R==&&Y==&&B==||B==&&Y==&&R==||Y==&&B==&&R==)//1个0,2个1
{
ans = ;
}
else ans = ; //2个0,1个1,3个0
}
printf("%I64d\n",ans);
}
return ;
}
2013nanjingJ的更多相关文章
随机推荐
- GSON使用笔记(1) -- 序列化时排除字段的几种方式
http://blog.csdn.net/zxhoo/article/details/21471005 GSON是Google发布的JSON序列化/反序列化工具,非常容易使用.本文简要讨论在使用GSO ...
- Android 使用 DownloadManager 管理系统下载任务的方法,android管理系统
从Android 2.3(API level 9)开始Android用系统服务(Service)的方式提供了Download Manager来优化处理长时间的下载操作.Download Manager ...
- .net 运用YUI相关的dll压缩js (按照自己的规则,想想都觉得强大和有趣)
写在前面 不管是做前端的还是做后台的,不管是懂javaScript的还是不太懂JavaScript的人,我想都或多或想的知道些许js压缩对于页面性能提升的效应吧. 之前老喜欢用在线压缩工具去压缩js, ...
- wpf comboBox取值问题
这是获取值后台代码 private void button1_Click(object sender, RoutedEventArgs e) { combBox = ...
- 最小路径(prim)算法
#include <stdio.h>#include <stdlib.h>/* 最小路径算法 -->prim算法 */#define VNUM 9#define MV 6 ...
- 9月6日表格标签(table、行、列、表头)(补)
一.<table> <table>代表表格标签. <table></table> 1.width 表示表格宽度,宽度表达方式有像素和百分比两种.网 ...
- MySQL学习笔记——安装及配置环境
1.安装的版本为mysql-5.6.24-win32.1432006610压缩版 查看教程http://jingyan.baidu.com/article/f3ad7d0ffc061a09c3345b ...
- (转)HBase 的原理和设计
转自:HBase的原理和设计 HBase架构:
- autofac获取全局Container
_UserService = ((IContainerProviderAccessor)HttpContext.Current.ApplicationInstance).ContainerProvid ...
- php实现发送邮件
smtp.php: <?php class smtp { /* Public Variables */ var $smtp_port; var $time_out; ...