题目链接

有红绿蓝三种颜色的画,每种拿三朵可以组成一束花,或者各拿一朵组成花束,告诉你每种花的数目,求出可能组成最多的花束。

如果你的代码过不了,考虑一下 8 8 9这种组合。  因为数据量很大,我的思想就是局部和总体采用不同的策略。

#include <iostream>
#include <algorithm> using namespace std; int main()
{
int r, g, b;
while (cin >> r >> g >> b)
{
int m = min(r, g);
m = min (m, b);
int ans = 0;
int a = 0;
for (int i = 0; i <= 10000 && i <= m; i++)
{
a = (r-i)/3 + (g-i)/3 + (b-i)/3 + i;
ans = max(a, ans);
}
cout << ans << endl;
}
return 0;
}

codeforces 322 B Ciel and Flowers的更多相关文章

  1. codeforces 322 A Ciel and Dancing

    题目链接 题意: 有n个男孩和m个女孩,他们要结对跳舞,每对要有一个女孩和一个男孩,而且其中一个要求之前没有和其他人结对,求出最大可以结多少对. 如图,一条线代表一对,只有这样三种情况. #inclu ...

  2. CF 322B Ciel and Flowers 贪心水题

    B. Ciel and Flowers time limit per test 1 second memory limit per test 256 megabytes input standard ...

  3. Codeforces Round #190 (Div. 2) B. Ciel and Flowers

    链接:http://codeforces.com/contest/322/problem/B 这题做错了.没考虑周全. #include <cstdio> #include <cst ...

  4. codeforces B. Ciel and Flowers 解题报告

    题目链接:http://codeforces.com/problemset/problem/322/B 题目意思:给定红花.绿花和蓝花的朵数,问组成四种花束(3朵红花,3朵绿花,3朵蓝花,1朵红花+1 ...

  5. codeforces 459 B.Pashmak and Flowers 解题报告

    题目链接:http://codeforces.com/problemset/problem/459/B 题目意思:有 n 朵 flowers,每朵flower有相应的 beauty,求出最大的beau ...

  6. 【81.82%】【codeforces 740B】Alyona and flowers

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  7. 网络流(费用流)CodeForces 321B:Ciel and Duel

    Fox Ciel is playing a card game with her friend Jiro. Jiro has n cards, each one has two attributes: ...

  8. Codeforces 451 E Devu and Flowers

    Discription Devu wants to decorate his garden with flowers. He has purchased n boxes, where the i-th ...

  9. 【Codeforces 258E】 Devu and Flowers

    [题目链接] http://codeforces.com/contest/451/problem/E [算法] 容斥原理 [代码] #include<bits/stdc++.h> usin ...

随机推荐

  1. AbstractQueuedSynchronizer(AQS)源码解析

          关于AQS的源码解析,本来是没有打算特意写一篇文章来介绍的.不过在写本学期课程作业中,有一门写了关于AQS的,而且也画了一些相关的图,所以直接拿过来分享一下,如有错误欢迎指正.       ...

  2. 【转载】BIO、NIO、AIO

    请看原文,排版更佳>转载请注明出处:http://blog.csdn.net/anxpp/article/details/51512200,谢谢! 本文会从传统的BIO到NIO再到AIO自浅至深 ...

  3. 【设计模式】【最后一个】结构型07适配器模式(Adapter Pattern)

    适配器模式(Adapter Pattern) 推荐一个很全面的博客:https://blog.csdn.net/zxt0601/article/details/52848004 定义:将一个类的接口转 ...

  4. vagrant+xdebug

    https://segmentfault.com/a/1190000007789295

  5. Wannafly挑战赛1:Treepath(DFS统计)

    题目链接 题意 给出一棵树,问长度为偶数的路径数有多少. 思路 记录路径长度为奇数的数目和为偶数的数目,然后 n * (n-1) / 2 求和即可. #include <bits/stdc++. ...

  6. Python之Pandas库学习(二):数据读写

    1. I/O API工具 读取函数 写入函数 read_csv to_csv read_excel to_excel read_hdf to_hdf read_sql to_sql read_json ...

  7. S7-1200 的运动控制

    S7-1200 CPU本体集成点硬件输出点最高频率为100kHz,信号板上硬件集成点输出的最高频率为20kHz,CPU在使用PTO功能时将把集成点Qa.o,Qa.2或信号板的Q4.0作为脉冲输出点,Q ...

  8. Centos7:yum安装MySQL5.7后如何设置root密码

    Centos下安装软件的方式很简单,只需要通过yum install xxx命令即可.第一步当然检查是否有mysql的yum源,命令:yum list|grep mysql-community[主要还 ...

  9. 提升布局性能____Re-using Layouts with <include/>

    可以再一个布局中通过"include"和"merge"元素进行复用其他的布局元素. 比如如下一个布局: <FrameLayout xmlns:androi ...

  10. MongoDB基础教程[菜鸟教程整理]

    MongoDB基础教程 ======================================================================================== ...