CodeForces 625A E - Guest From the Past
2016-07-08 20:45
363 查看
贪心,如果b-c<a,那么买b,剩下买a
#include<cstdio>
unsigned long long n,a,b,c,ans;
int main(){
scanf("%lld%lld%lld%lld",&n,&a,&b,&c);
if(b-c<a && n>=b){
ans=(n-b)/(b-c)+1;
n-=(b-c)*ans;
}
ans+=n/a;
printf("%lld",ans);
return 0;
}
#include<cstdio>
unsigned long long n,a,b,c,ans;
int main(){
scanf("%lld%lld%lld%lld",&n,&a,&b,&c);
if(b-c<a && n>=b){
ans=(n-b)/(b-c)+1;
n-=(b-c)*ans;
}
ans+=n/a;
printf("%lld",ans);
return 0;
}
相关文章推荐
- CodeForces 626A B - Robot Sequence
- iOS UITabBar属性详解 UITabBarController 底部 UITabBarItem 间距调整
- hdu5286 wyh2000 and sequence
- SOAPUI使用教程-REST请求工作
- android studio关于build/outputs/apk/中apk或arr或jar无法删除的解决方法
- hdu 5063 Operation the Sequence(思路)
- UIweib的简单实用
- 将UIview描画成虚线等.
- 去掉UITableView多余的空白行分割线
- js 用defaultValue 模拟重置键 reset
- QOS-4 Queue队列机制-2 CBWFQ and LLQ
- QOS-3 Queue 队列机制
- UVA - 424 Integer Inquiry
- JUC源码分析19-队列-PriorityBlockingQueue
- Android UI性能问题探讨
- iOS UITextView 纯英文排版换行出错的解决方案
- dump View Hierarchy for UI automator
- UITableView的内容视图在有无导航栏下的区别
- iOS UiCollectionViewtroller 间距清0
- dlopen “no suitable image found ”问题之解决