Codeforces Round #379 (Div. 2) B. Anton and Digits(简单贪心)
2016-11-21 18:38
585 查看
题目链接:http://codeforces.com/contest/734/problem/B
【中文题意】给你k2个2,k3个3,k5个5,k6个6,然后让你用这些数组成32和256,组成的数的和是多少。
【思路分析】首先考虑,5和6只能用于组成256,且只消耗了一个2,所以优先组合256,然后用剩下的2与3组合。
【AC代码】
【中文题意】给你k2个2,k3个3,k5个5,k6个6,然后让你用这些数组成32和256,组成的数的和是多少。
【思路分析】首先考虑,5和6只能用于组成256,且只消耗了一个2,所以优先组合256,然后用剩下的2与3组合。
【AC代码】
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; int main() { int a,b,c,d; while(~scanf("%d%d%d%d",&a,&b,&c,&d)) { int sum=0; int x=min(min(a,c),d); sum=x*256; a-=x; c-=x; d-=x; x=min(a,b); sum+=x*32; printf("%d\n",sum); } return 0; }
相关文章推荐
- Codeforces Round #379 (Div. 2)-D. Anton and Chess
- Codeforces Round #379 (Div. 2) E. Anton and Tree
- Codeforces Round #324 (Div. 2) E. Anton and Ira 贪心
- Codeforces Round #379 (Div. 2) F. Anton and School
- Codeforces Round #277.5 (Div. 2)——C贪心—— Given Length and Sum of Digits
- Codeforces Round #379 (Div. 2) D. Anton and Chess 水题
- Codeforces Round #324 (Div. 2) E. Anton and Ira(贪心)
- Codeforces Round #277.5 (Div. 2)C. Given Length and Sum of Digits...(贪心)
- 【Codeforces Round 169 (Div 2) D】【简单数位贪心】Little Girl and Maximum XOR 区间选两数使得异或值尽可能大
- Codeforces Round #379 (Div. 2) C. Anton and Making Potions 枚举+二分
- 【Codeforces Round 370 (Div 2) B】【简单贪心】Memory and Trident
- Codeforces Round #277.5 (Div. 2)C. Given Length and Sum of Digits...(贪心)
- Codeforces Round #379 (Div. 2) F. Anton and School
- Codeforces Round #379 (Div. 2)-C. Anton and Making Potions
- Codeforces Round #379 (Div. 2) E. Anton and Tree 树的直径
- 【Codeforces Round 324 (Div 2)E】【贪心 构造】Anton and Ira 全排列交换 最小距离成本
- Codeforces Round #277.5(Div. 2) C. Given Length and Sum of Digits...【贪心】
- Codeforces Round #379 (Div. 2)E. Anton and Tree
- Codeforces Round #379 (Div. 2) D. Anton and Chess 模拟
- Codeforces Round #280 (Div. 2) C. Vanya and Exams 贪心