526C - Om Nom and Candies
2015-04-05 09:46
405 查看
#include<cstdio> #include<cstring> #include<cstdlib> #include<algorithm> #include<queue> #include<map> #include<vector> #include<stack> #pragma comment(linker, "/STACK:102400000,102400000") #define ll __int64 using namespace std; int main(){ ll c, hr, hb, wr, wb; while (scanf("%I64d%I64d%I64d%I64d%I64d",&c,&hr,&hb,&wr,&wb) != EOF){ ll ans = 0; for (int i = 0; i<1000001; i++){ if (c - wr*i < 0) break; ans = max(ans, hr*i + (c-wr*i) / wb * hb); } for (int i = 0; i<1000001; i++){ if (c - wb*i < 0) break; ans = max(ans, hb*i + (c-wb*i) / wr * hr); } printf("%I64d\n",ans); } return 0; }
相关文章推荐
- Codeforces 526C - Om Nom and Candies (贪心 + 思维)
- Codeforces 526C - Om Nom and Candies(贪心,暴力)
- Codeforces 526C - Om Nom and Candies
- Codeforces 526C - Om Nom and Candies(贪心)
- 【Henu ACM Round#19 E】 Om Nom and Candies
- C. Om Nom and Candies(ZeptoLab Code Rush 2015)
- ZeptoLab Code Rush 2015 C. Om Nom and Candies
- ZeptoLab Code Rush 2015---C. Om Nom and Candies
- ZeptoLab Code Rush 2015 C题Om Nom and Candies
- ZeptoLab Code Rush 2015 C. Om Nom and Candies 暴力
- Codeforces 526D Om Nom and Necklace 循环节 kmp
- ZeptoLab Code Rush 2015_B - Om Nom and Dark Park
- Zepto Code Rush 2014 B - Om Nom and Spiders
- 判断s各个前缀是否是 ABABA…ABA的形式 KMP Codeforces 526D - Om Nom and Necklace
- Codeforces 526C Om Nom and Candies
- Codefoces 436 B. Om Nom and Spiders
- Om Nom and Dark Park
- 526B - Om Nom and Dark Park
- CF Zepto Code Rush 2014 B. Om Nom and Spiders
- ZeptoLab Code Rush 2015 B. Om Nom and Dark Park