博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
poj 3863Business Center
阅读量:4203 次
发布时间:2019-05-26

本文共 799 字,大约阅读时间需要 2 分钟。

给你n和m,你要按n次按钮,接下来m行,每行a和b,代表上a层,下b层,但不能钻到地下去。

假设上x层,则下(n-x)层,所以有a*x-b*(n-x)>0,==>(a+b)*x-b*n>0,==>x=(b*n+a+b)/(a+b);

大哭

////  main.cpp//  160929////  Created by 刘哲 on 17/4/6.//  Copyright © 2016年 my_code. All rights reserved.////#include 
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define lowbit(x) (x&-x)using namespace std;int main(){ freopen("business.in","r",stdin); freopen("business.out","w",stdout); long long n,m; cin>>n>>m; long long ans = 0x3f3f3f3f3f; while(m--) { long long a,b; cin>>a>>b; //int t = ceil(b*n/(a+b)); int t = (b*n+a+b)/(a+b); //ans = min(ans,(long long)t*((long long)a+(long long)b)-(long long)b*n); ans = min(ans,t*(a+b)-b*n); } cout<
<

你可能感兴趣的文章
JNI HelloWorld的例子
查看>>
JAVA 网络编程
查看>>
JAVA 反射机制详解
查看>>
JAVA 读取Properties配置文件
查看>>
JavaWeb 使用Intellij IDEA部署Web项目出现JmxAdminException
查看>>
Maven 使用Intellij IDEA部署添加Maven Module出现 'pom.xml' already exists in VFS
查看>>
Git .gitignore文件比较完善的写法
查看>>
JavaWeb 提交中文数据乱码问题总结
查看>>
JavaWeb forward与sendRedirect区别
查看>>
JavaWeb 报错The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml
查看>>
JavaWeb getParameter和getAttribute的区别
查看>>
JavaWeb jsp内置对象与servlet对应关系
查看>>
Spring 之依赖注入DI
查看>>
Spring 注解总结
查看>>
Spring 面向切面编程AOP
查看>>
数据库优化 SQL语句优化
查看>>
Spring 各个jar包的作用
查看>>
SpringMVC 出现ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
查看>>
SpringMVC 过滤器HiddenHttpMethodFilter
查看>>
SpringMVC 返回json数据报错IllegalArgumentException: No converter found for return value of type:xxx
查看>>