CodeForces 625A Guest From the Past
贪心水题
#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的更多相关文章
- 【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 ...
- 【CodeForces 625A】Guest From the Past
题 题意 一升奶可以花费a元,也可以话b元买然后获得c元,一开始有n元,求最多买多少升奶. 分析 贪心,如果b-c<a,且n≥b,那就买b元的,n先减去b再看看够买多少瓶,然后再+1瓶,余款再购 ...
- CodeForces 625A 思维
题意是说一个人喝酒 有两种办法 买塑料瓶的 a块钱 喝了就没了 或者是买玻璃瓶的b块钱 喝完还能卖了瓶子c块钱 求最多能喝多少瓶 在开始判断一次 a与b-c的关系 即两种方式喝酒的成本 如果a< ...
- 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 ...
- 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 ...
- Codeforces Round #342 (Div. 2)-A. Guest From the Past
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- CodeForces - 261B Maxim and Restaurant
http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a ...
- 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 ...
- Codeforces 834E The Bakery【枚举+数位dp】
E. Ever-Hungry Krakozyabra time limit per test:1 second memory limit per test:256 megabytes input:st ...
随机推荐
- MFC笔记<持续更新>
1.设置垂直滚动条的位置在末尾 SCROLLINFO si; GetScrollInfo(SB_VERT, &si, SIF_PAGE | SIF_RANGE | SIF_POS); si.f ...
- linux的学习系列 10---vi
Linux下的文本编辑器有很多种,vi 是最常用的,也是各版本Linux的标配.注意,vi 仅仅是一个文本编辑器,可以给字符着色,可以自动补全,但是不像 Windows 下的 word 有排版功能. ...
- ibatis 自动生成map,bean,dao
1.下载 AbatorForEclipse1.1.0 地址:http://download.csdn.net/detail/fym548/9426877 点击Archive按钮选择下载的,然后重启My ...
- 锤子便签的 monkeyrunner 测试脚本(转)
https://testerhome.com/topics/878 MonkeyRunner可能大家已经听过无数次了,大家在网上也看过了各种关于的它的资料了,我这里就不再过多的啰嗦它的用途了,它可以对 ...
- UVALive 2522 Chocolate(概率DP)
思路:定义DP方程dp[i][j]标记选到第i个巧克力的时候,桌面上还剩下j个巧克力,状态转移有两个方向,dp[i-1][j-1],dp[i-1]lj+1],分别表示桌面上多了一个和消了一个,乘上需要 ...
- Python中括号的区别及用途
python语言最常见的括号有三种,分别是:小括号( ).中括号[ ]和大括号也叫做花括号{ }.其作用也各不相同,分别用来代表不同的python基本内置数据类型. python中的小括号( ):代表 ...
- editplus 正则删换行
editplus regular expression ctrl+h 1.替换开始是空行 ^[\t ]*\n 2.替换换行 \n 3.替换包含某字符 .*@126.* excel去重复(或者保留一个 ...
- Pro/TOOLKIT入门教程汇总
手把手教你开发Pro/TOOLKIT应用程序 手把手教你开发Pro/TOOLKIT应用程序(一) 手把手教你开发Pro/TOOLKIT应用程序(二) 手把手教你开发Pro/TOOLKIT应用程序(三) ...
- MFC乱七八糟笔记
1.CBitmap------------------------------------------------------------------------------------- 1.类层次 ...
- PVST+(每个VLAN 的生成树PVST 加)
PVST+(每个VLAN 的生成树PVST 加) 实验拓扑: 分别在 SW1 和SW2 上show spanning-tree 查看结果: SW1#show spanning-tree VLAN000 ...