cf478C Table Decorations
You have r red, g green and b blue balloons. To decorate a single table for the banquet you need exactly three balloons. Three balloons attached to some table shouldn't have the same color. What maximum number t of tables can be decorated if we know number of balloons of each color?
Your task is to write a program that for given values r, g and b will find the maximum number t of tables, that can be decorated in the required manner.
The single line contains three integers r, g and b (0 ≤ r, g, b ≤ 2·109) — the number of red, green and blue baloons respectively. The numbers are separated by exactly one space.
Print a single integer t — the maximum number of tables that can be decorated in the required manner.
5 4 3
4
1 1 1
1
2 3 3
2
In the first sample you can decorate the tables with the following balloon sets: "rgg", "gbb", "brr", "rrg", where "r", "g" and "b" represent the red, green and blue balls, respectively.
这题被搞惨了……各种乱搞都不对啊
orz hzwer
如果最大的气球比另外两种的气球数量之和小,就可以直接组成sum/3个
否则全部都是2:1的方案
#include <stdio.h>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
long long i,j,t,n,m,l,r,k,z,y,x;
long long g,b,ans;
int main()
{
scanf("%I64d%I64d%I64d",&r,&g,&b);
ans=min(min(min((r+g+b)/,r+g),r+b),b+g);
printf("%I64d\n",ans);
return ;
}
cf478C
cf478C Table Decorations的更多相关文章
- CF-478C Table Decorations (贪心)
Table Decorations Time limit per test: 1 second Memory limit per test: 256 megabytes Problem Descrip ...
- CodeForces 478C Table Decorations
Table Decorations Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u ...
- C. Table Decorations(Codeforces Round 273)
C. Table Decorations time limit per test 1 second memory limit per test 256 megabytes input standard ...
- 【CODEFORCES】 C. Table Decorations
C. Table Decorations time limit per test 1 second memory limit per test 256 megabytes input standard ...
- codeforces 的 Codeforces Round #273 (Div. 2) --C Table Decorations
C. Table Decorations time limit per test 1 second memory limit per test 256 megabytes input standard ...
- Codeforces Round #273 (Div. 2)-C. Table Decorations
http://codeforces.com/contest/478/problem/C C. Table Decorations time limit per test 1 second memory ...
- 贪心 Codeforces Round #273 (Div. 2) C. Table Decorations
题目传送门 /* 贪心:排序后,当a[3] > 2 * (a[1] + a[2]), 可以最多的2个,其他的都是1个,ggr,ggb, ggr... ans = a[1] + a[2]; 或先2 ...
- Codeforces Round #273 (Div. 2)C. Table Decorations 数学
C. Table Decorations You have r red, g green and b blue balloons. To decorate a single table for t ...
- C. Table Decorations
time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...
随机推荐
- 深入浅出Node.js (5) - 内存控制
5.1 V8的垃圾回收机制与内存限制 5.1.1 Node与V8 5.1.2 V8的内存限制 5.1.3 V8的对象分配 5.1.4 V8的垃圾回收机制 5.1.5 查看垃圾回收日志 5.2 高效使用 ...
- webapp设计注意事项
色彩设计 美学相关的知识(色彩构成.平面构成等等)我就不再赘述了,相信从事此类行业的人员无人不知无人不晓了.这里简要说说WebApp设计中,色彩以及构图的特别之处吧. 首先是色彩.从事过广告和印刷业设 ...
- php-timeit估计php函数的执行时间
首先,前段时间利用手头的日本VPS搭建了一个google代理,访问速度还行,分享给大家: 谷歌 谷歌:guge119.com 谷歌学术:scholar.guge119.com 有时候我们在PHP性能优 ...
- shell数组(产生不同的随机数)
#!/bin/bash # declare -a ARRAY read -p "Please input num[1-39]:" EMENUM #对比新生成的随机数是否重复 fun ...
- python标准库 sysconfig模块
# -*- coding: utf-8 -*-# python:2.x__author__ = 'Administrator'import sysconfig#sysconfig:解释器编译时配置#作 ...
- High bridge, low bridge(离散化, 前缀和)
High bridge, low bridge Q:There are one high bridge and one low bridge across the river. The river h ...
- 面试前的准备---C#知识点回顾----04
播下的种子,慢慢开始发芽收获了,陆陆续续offer就来了,该轮到我挑的时候了 今天面试的一家公司,技术问的相对宽广和细致,程度令人发指 1.谈谈ViewState 这个问题,回答的好,工资翻一级 基本 ...
- socket——本地服务器和android手机客户端通讯(防止中文乱码)
线上效果图: 服务端接收到的. 客户端接受到服务器返回的. server端代码直接运行在本地就可以了. 手机客户端运行在手机上就行. 先安装客户端,再启动server.然后再输入文字,点击发送. se ...
- javascript的本地存储 cookies、localStorage
一.cookies 本地存储 首先是常用的cookies方法,网上有很多相关的代码以及w3cSchool cookies. // 存储cookies function setCookie(name,v ...
- JS 逗号表达式
JavaScript中逗号运算符 JavaScript中逗号运算符(,)是顺序执行两个表达式.使用方法: expression1, expression2 其中expression1是任何表达式.ex ...