DP

#include<cstdio>
using namespace std;
int T,A,B,F[5000005],G[5000005];
int main(){
scanf("%d%d%d",&T,&A,&B);
F[0]=1;
for (int i=0; i<=T; i++) F[i+A]|=F[i],F[i+B]|=F[i];
for (int i=0; i<=T; i++) G[i/2]|=F[i];
for (int i=0; i<=T; i++) G[i+A]|=G[i],G[i+B]|=G[i];
for (int i=T; i>=0; i--)
if (F[i] || G[i]){
printf("%d\n",i);
return 0;
}
return 0;
}

  

BZOJ 4393: [Usaco2015 Dec]Fruit Feast的更多相关文章

  1. bzoj4393: [Usaco2015 Dec]Fruit Feast

    题意: T,A,B.T是上限.A和B可以随意吃但是不能超过T.有一次将吃的东西/2的机会.然后可以继续吃,不能超过T.问最多可以吃多少. =>我们先处理不能/2可以吃到哪些.然后弄个双指针扫一扫 ...

  2. BZOJ 4390: [Usaco2015 dec]Max Flow

    4390: [Usaco2015 dec]Max Flow Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 177  Solved: 113[Submi ...

  3. bzoj 4397: [Usaco2015 dec]Breed Counting -- 前缀和

    4397: [Usaco2015 dec]Breed Counting Time Limit: 10 Sec  Memory Limit: 128 MB Description Farmer John ...

  4. 【刷题】BZOJ 4391 [Usaco2015 dec]High Card Low Card

    Description Bessie the cow is a huge fan of card games, which is quite surprising, given her lack of ...

  5. 【BZOJ4391】[Usaco2015 dec]High Card Low Card(贪心)

    [BZOJ4391][Usaco2015 dec]High Card Low Card(贪心) 题面 BZOJ 题解 预处理前缀后缀的结果,中间找个地方合并就好了. #include<iostr ...

  6. USACO 2015 December Contest, Gold Problem 2. Fruit Feast

    Problem 2. Fruit Feast 很简单的智商题(因为碰巧脑出来了所以简单一,一 原题: Bessie has broken into Farmer John's house again! ...

  7. Fruit Feast

    Fruit Feast 题目描述 Bessie has broken into Farmer John's house again! She has discovered a pile of lemo ...

  8. BZOJ5142: [Usaco2017 Dec]Haybale Feast(双指针&set)(可线段树优化)

    5142: [Usaco2017 Dec]Haybale Feast Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 182  Solved: 131[ ...

  9. [Usaco2015 dec]Max Flow 树上差分

    [Usaco2015 dec]Max Flow Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 353  Solved: 236[Submit][Sta ...

随机推荐

  1. vscode 常用插件安装

    设置中文语言使用快捷键[Ctrl+Shift+P],弹出的搜索框中输入[configure language],然后选择搜索出来的[Configure Display Language],locale ...

  2. jQuery知识重构

    jQuery知识重构 目录: 一.入口函数 1          $(document).ready(function(){}); 2          $(function(){}); jQuery ...

  3. >>我要到处浪系列 之 JS随便投票小脚本

    首先郑重声明:我不是对任何网站或者任何个人或组织有意见,仅仅是觉得 4点几 的评分对某些玩票的片段都太高了,为了落实想法,切实履行公民的投票权,并且 bibibabibobi biubiubiu..所 ...

  4. windows 下设置MTU数值

    输入:netsh interface ipv4 show subinterfaces 查询到目前系统的MTU值.再分别输入一行按一次回车键. netsh interface ipv4 set subi ...

  5. Eucalyptus学习汇总

    Elastic Utility Computing Architecture for Linking Your Programs To Useful Systems (Eucalyptus) 是一种开 ...

  6. 编程之美2015 资格赛 hihocoder 题目2: 回文字符序列

    思路:暴力搜,用BFS的方式,生成每一种可能,再对每一种可能进行判断是否回文,进行统计.严重超时!计算一个25个字符的,大概要20多秒! #include <iostream> #incl ...

  7. IOS 绘制画画板(封装上下文)

    封装上下文 UIImage (CaptureView).h / .m @interface UIImage (CaptureView) + (UIImage *)captureImageWithVie ...

  8. securetextentry 切换后有空格问题解决

    搜索发现这个问题,网上的解决方法不明确,对于小白怎么办 直接上代码: - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundCo ...

  9. 问题 M: 克隆玩具

    题目描述 你只有一个A类型玩具,现在有个有两种功能的机器:1. 加工一个A类型的玩具能够再得到一个A类型的玩具和一个B类型的玩具.2. 加工一个B类型的玩具,能得到两个B类型的玩具. 问经过多次加工之 ...

  10. c# 科学计数法值转换成正常值,返回字符串

    /// <summary> /// 科学计数法值转换成正常值 /// </summary> /// <param name="value">&l ...