POJ 3863 Business Center
Business Center
This problem will be judged on PKU. Original ID: 3863
64-bit integer IO format: %lld Java class name: Main
You start on the ground floor of the business center. You have to choose one elevator car out of m to ride on. You cannot switch elevators cars after that. What is the lowest floor above the ground floor you can get to after you press elevator car buttons exactly n times?
Input
Output
Sample Input
10 3
15 12
15 4
7 12
Sample Output
13
Source
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
LL n,m,u,d,ret;
void check() {
LL tmp = (n*d+u+d)/(u+d);
ret = min(ret,(u+d)*tmp - n*d);
}
int main() {
ios::sync_with_stdio(false);
cin>>n>>m;
ret = INT_MAX;
while(m--) {
cin>>u>>d;
check();
}
cout<<ret<<endl;
return ;
}
POJ 3863 Business Center的更多相关文章
- UVa 1648 (推公式) Business Center
题意: 有一种奇怪的电梯,每次只能向上走u个楼层或者向下走d个楼层 现在有m个这种电梯,求恰好n次能够到达的最小楼层数(必须是正数),最开始默认位于第0层. 分析: 假设电梯向上走x次,则向下走n-x ...
- BZOJ 4159 [Neerc2009]Business Center
思路 简单的模拟,答案就是\(min\{(\lfloor\frac{d\times n}{u+d}\rfloor+1)\times(u+d)-d\times n\}\) 代码 #include < ...
- UVA 1648 Business Center
https://vjudge.net/problem/UVA-1648 设上升x层,列个方程解出来,再把x带回去 #include<cmath> #include<cstdio> ...
- bzoj AC倒序
Search GO 说明:输入题号直接进入相应题目,如需搜索含数字的题目,请在关键词前加单引号 Problem ID Title Source AC Submit Y 1000 A+B Problem ...
- 2015 UESTC Winter Training #10【Northeastern Europe 2009】
2015 UESTC Winter Training #10 Northeastern Europe 2009 最近集训都不在状态啊,嘛,上午一直在练车,比赛时也是刚吃过午饭,状态不好也难免,下次比赛 ...
- Angular material mat-icon 资源参考_Places
ul,li>ol { margin-bottom: 0 } dt { font-weight: 700 } dd { margin: 0 1.5em 1.5em } img { height: ...
- Inventor2018专业版软件安装激活教程
如果你安装的是Autodesk Inventor Professional 2018,那么序列号为:666-69696969,产品密钥为:797J1, 如果你安装的是Autodesk Inventor ...
- OptaPlanner 7.32.0.Final版本彩蛋 - SolverManager之异步求解
因为工作和其它原因,很长一段时间没有出新的.关于OptaPlanner的文章了,但工余时间并没有停止对该引擎的学习.与此同时Geoffrey大神带领的KIE项目团队并没有闲下来,尽管在工业可用性.易用 ...
- POJ 2774 Long Long Message 后缀数组
Long Long Message Description The little cat is majoring in physics in the capital of Byterland. A ...
随机推荐
- Java事件处理机制2
实现一个小程序,怎样让小球受到键盘的控制,上下左右移动,如图: public class Demo3 extends JFrame{ MyPanel mp=null; public static vo ...
- shell-3.bash的基本功能:输入输出重定向
1. 2. 3. 4.
- sass的用法小结(二)
3. 导入SASS文件; css有一个特别不常用的特性,即@import规则,它允许在一个css文件中导入其他css文件.然而,后果是只有执行到@import时,浏览器才会去下载其他css文件,这导致 ...
- vue 事件上加阻止冒泡 阻止默认事件
重点 vue事件修饰符 <!-- 阻止单击事件冒泡 --> <a v-on:click.stop="doThis"></a> <!-- 提 ...
- WebKit.NET-0.5简单应用
最近想用c#做个简单的浏览器工具,但是网站一些内容不支持c#内置的WebBowser控件,于是只能改用其他内核浏览器进行开发,搜索到WebKit.NET这个封装好的浏览器引擎,需求的功能也都有,于是用 ...
- CentOS7 部署SVN服务器
服务器端:svnserver 安装主要步骤 yum install subversion rpm -ql subversion mkdir /application/svndata mkdir /ap ...
- Regular Expressions Syntax
https://support.syslogwatcher.com/support/solutions/articles/8000033627-regular-expressions-syntax
- 洛谷 P2970 [USACO09DEC]自私的放牧Selfish Grazing
P2970 [USACO09DEC]自私的放牧Selfish Grazing 题目描述 Each of Farmer John's N (1 <= N <= 50,000) cows li ...
- XCL-Chart柱形图的期望线/分界线
周日在柱形图上加了两个小功能,当中之中的一个是加上了期望线/分界线,功能非常小,但我个人非常喜欢这个功能(好像之前也没看到别的图表库原生支持这个. ) 主要是加上这些小小的横线后,能非常明显的区分出数 ...
- 页面头部带loading进度指示的jQuery滚动页面特效
这是一款非常有用且效果非常酷的jQuery页面头部带loading进度指示的滚动页面特效. 该特效在页面滚动的时候页面头部有Loading进度条指示当前页面滚动的位置,这能够让用户知道当前阅读的地方距 ...