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. OC 中 self 与 super 总结

    一段代码引发的思考: @implementation Son : Father - (id)init { self = [super init]; if (self) { NSLog(@"% ...

  2. 在Magento中用MySQL模拟队列发送电子邮件

    1. 需求 顾客在网站上购买特定商品并且这些商品的总金额超过特定金额后,使用email给顾客发送一个优惠券:假如某件商品已经降价了,则此商品的金额不计算在目标总金额内: 2. 需求分析 ①发送优惠券的 ...

  3. BaiduPCS-Go 使用CMD命令行全速下载百度云

    BaiduPCS-Go 使用CMD命令行全速下载百度云 链接: https://laod.cn/black-technology/baidupcs-go-baiduyun.html 下面为自己测试过程 ...

  4. JavaScript初始

    一.JavaScript基础 1.引入方式 <!--1 直接编写--> <script> alert('hello yuan') </script> <!-- ...

  5. CF1152C Neko does Maths

    思路: 假设a <= b,lcm(a + k, b + k) = (a + k) * (b + k) / gcd(a + k, b + k) = (a + k) * (b + k) / gcd( ...

  6. Every ending is just a new beginning.

    Every ending is just a new beginning.每次结束都是新的开始.

  7. 飞塔NGFW-FortiGate-5.2(BYOL)

    平台: FortiGate 类型: 虚拟机镜像 软件包: basic software FortiGate ips security UTM vpn 反垃圾邮件 网页过滤 服务优惠价: 按服务商许可协 ...

  8. leetcode——2

    1. 题目 Add Two Numbers You are given two linked lists representing two non-negative numbers. The digi ...

  9. Android多媒体框架总结(1) - 利用MediaMuxer合成音视频数据流程分析

    场景介绍: 设备端通过服务器传向客户端(Android手机)实时发送视频数据(H.264)和音频数据(g711a或g711u), 需要在客户端将音视频数据保存为MP4文件存放在本地,用户可以通过APP ...

  10. m3u8视频下载方法

    部分网站的视频内容,采用了m3u8的格式.正常打开网页可以,但是如果想下载到本地,就存在一定问题了.这里可以再获取到m3u8地址之后,利用vlc软件,来下载m3u8的视频. 工具:Firefox浏览器 ...