贪心水题

#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <queue>
#include <stack>
#include <map>
#include <vector>
using namespace std; long long ans;
long long n,a,b,c; int main()
{ scanf("%lld%lld%lld%lld",&n,&a,&b,&c);
ans=; if(a<=b-c) ans=n/a;
else
{
if(n>=b)
{
ans=(n-b)/(b-c);
n=n-ans*(b-c);
if(n>=b) ans++,n=n-b+c;
} ans=ans+n/a;
}
printf("%lld\n",ans);
return ;
}

CodeForces 625A Guest From the Past的更多相关文章

  1. 【15.07%】【codeforces 625A】Guest From the Past

    time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...

  2. 【CodeForces 625A】Guest From the Past

    题 题意 一升奶可以花费a元,也可以话b元买然后获得c元,一开始有n元,求最多买多少升奶. 分析 贪心,如果b-c<a,且n≥b,那就买b元的,n先减去b再看看够买多少瓶,然后再+1瓶,余款再购 ...

  3. CodeForces 625A 思维

    题意是说一个人喝酒 有两种办法 买塑料瓶的 a块钱 喝了就没了 或者是买玻璃瓶的b块钱 喝完还能卖了瓶子c块钱 求最多能喝多少瓶 在开始判断一次 a与b-c的关系 即两种方式喝酒的成本 如果a< ...

  4. Codeforces Round #342 (Div. 2) A - Guest From the Past 数学

    A. Guest From the Past 题目连接: http://www.codeforces.com/contest/625/problem/A Description Kolya Geras ...

  5. Codeforces Round #342 (Div. 2) A. Guest From the Past(贪心)

    传送门 Description Kolya Gerasimov loves kefir very much. He lives in year 1984 and knows all the detai ...

  6. Codeforces Round #342 (Div. 2)-A. Guest From the Past

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  7. CodeForces - 261B Maxim and Restaurant

    http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a ...

  8. Codeforces Round #329 (Div. 2) D. Happy Tree Party 树链剖分

    D. Happy Tree Party Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/593/p ...

  9. Codeforces 834E The Bakery【枚举+数位dp】

    E. Ever-Hungry Krakozyabra time limit per test:1 second memory limit per test:256 megabytes input:st ...

随机推荐

  1. java基础概念经典题目汇集

    1.下面是People和Child类的定义和构造方法,每个构造方法都输出编号.在执行new Child("mike")的时候都有哪些构造方法被顺序调用?请选择输出结果 ( ) cl ...

  2. JSP中文编码问题

    这个乱码问题是最简单的乱码问题.一般新会出现.就是页面编码不一致导致的乱码. <%@ page language="java" pageEncoding="UTF- ...

  3. javascript语句语义大全(1)

    1. <script></script> javascript标签对,所有javascript内容都会写在这个里面 2. var a=0; var a; 变量的声明,上面的是声 ...

  4. lucene-SpanNotQuery和SpanOrQuery交迭与全局跨度

    1.在匹配结果中排除相互交迭的跨度 SpanNotQuery构造函数的第一个参数表示要包含的跨度对象,第二个参数表示要排除的跨度对象. 1) SpanNearQuery quick_fox=new S ...

  5. HDU 5833 (2016大学生网络预选赛) Zhu and 772002(高斯消元求齐次方程的秩)

    网络预选赛的题目……比赛的时候没有做上,确实是没啥思路,只知道肯定是整数分解,然后乘起来素数的幂肯定是偶数,然后就不知道该怎么办了… 最后题目要求输出方案数,首先根据题目应该能写出如下齐次方程(从别人 ...

  6. Light OJ - 1058 Parallelogram Counting(判定平行四边形)

    Description There are n distinct points in the plane, given by their integer coordinates. Find the n ...

  7. dev GridControl直接打印 纵向合并单元格

    GridControl纵向合并单元格 只需设置 gridView->OptionView->AllowCellMerge=true; 效果 提示: 精确到列 前提是gridview1已经允 ...

  8. ReactiveCocoa Weak-Strong Dance

    AC在应用中大量使用了block,由于Objective-C语言的内存管理是基于引用计数的,为了避免循环引用问题,在block中如果要引用self,需要使用@weakify(self)和@strong ...

  9. mystring c++ 自己的string 封装

    1 /************************************************************************* > File Name: mystrin ...

  10. 兼容性,float

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...