codeforces 322B--(YY题)
来源:互联网 发布:算法设计技巧与分析 编辑:程序博客网 时间:2024/06/02 07:52
题意:red green blue 三色用四种方法做花束,求能做的最大的花束数目
分析:我一开始以为是贪心,但是也找不到什么明显的贪心的思路,不过还是用了两种极限的分配方法,不停的WA 我找不到原因啊,这题真的看不出什么特别的算法啊,然后问了别人,他只是讲出了一种分法以及这其中要单独讨论的特例,好吧,这就是个纯粹的yy题,我醉了
#include<iostream>using namespace std;int main(){int r,g,b;int sum=0;cin>>r>>g>>b;int tmp=min(min(r,g),b);sum=tmp;r-=tmp,g-=tmp,b-=tmp;if(r%3+g%3+b%3==4&&sum) sum++;sum=sum+r/3+g/3+b/3;cout<<sum<<endl;}
0 0
- codeforces 322B--(YY题)
- CodeForces 11B--(YY题)
- CodeForces 351B Jeff and Furik(YY题)
- codeforces 558B Amr and The Large Array-yy
- codeforces 399A Pages-yy题
- CodeForces 66D--思维(yy)
- codeforces 397B On Corruption and Numbers-yy-(求区间内的整数能否凑成某一整数)
- !codeforces 558C Amr and Chemistry-yy题-(位运算相关)
- CodeForces 292D Connected Components (并查集+YY)
- codeforces 255C DP yy
- CodeForces 123A 构造 + YY
- CodeForces 429B()
- Codeforces 682C Alyona and the Tree【Dfs+YY思维】好题
- CodeForces 525D Arthur and Walls(DIV2 D) (DFS+YY)
- Codeforces Round #296 Dvi2 D. Clique Problem (数学的大YY)
- !codeforces 400E Inna and Binary Logic-yy-(位运算)
- Educational Codeforces Round 11——C. Hard Process(YY)
- CodeForces 128D Numbers 贪心 或 YY
- 冲突域和广播域
- 两个数值比较大小
- Android入门:广播接收者应用(电话拦截器)
- (5)设计模式:Proxy
- BNU ---- 收成
- codeforces 322B--(YY题)
- 数字反转问题
- 中介者模式
- SQL join 语句 画图果然更容易理解
- 愉快的周末 新的一周又开始
- Android入门:广播接收者应用(短信窃听器)
- 122、Error: Apache shutdown unexpectedly
- IOS 整体框架类图值得收藏
- 需求文档如何编写