UVA 1648 Business Center
2024-08-24 05:05:26
https://vjudge.net/problem/UVA-1648
设上升x层,列个方程解出来,再把x带回去
#include<cmath>
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int u[],d[];
int main()
{
int n,m,ans,x;
while(scanf("%d%d",&n,&m)!=EOF)
{
ans=2e9;
for(int i=;i<=m;i++) scanf("%d%d",&u[i],&d[i]);
for(int i=;i<=m;i++)
{
x=d[i]*n/(u[i]+d[i])+;
ans=min(ans,u[i]*x-d[i]*(n-x));
}
printf("%d\n",ans);
}
}
最新文章
- chrome浏览器 开发者工具简介
- 《Google软件测试之道》基础
- C语言实现冒泡排序-整数排序
- 由《win32多线程程序设计》临界区的问题所想
- curl返回常见错误码
- android 数据库的增删改查
- BZOJ2021: [Usaco2010 Jan]Cheese Towers
- Django学习笔记二
- Docker操作笔记(一)使用镜像
- MongoDB 简单操作
- SSM学习(一)Mybatis
- Mac安装python3.x+pycharm+elasticsearch+常见报错处理(1)
- python3对比python2的更新点
- 推荐一篇关于java集合的博文,写的很nice
- Jmeter学习——http请求Content encoding的重要性
- postgresql安装概览
- PTA第一个编程题总结
- Netflix分享构建Microservices的经验
- 50-用Python监听鼠标和键盘事件
- 第二章 flex处理二义性
热门文章
- HDU 3260/POJ 3827 Facer is learning to swim(DP+搜索)(2009 Asia Ningbo Regional)
- C语言文件基本操作
- “Hello World!”团队第三周召开的第五次会议
- mysql 只返回一条数据
- Python 服务器端表单验证插件
- 第一、二章——Python简介与Python基础
- SQL 单表分页存储过程和单表多字段排序和任意字段分页存储过程
- 【Linux】- Ubuntu安装redis,并开启远程访问
- IE8 兼容CSS3 使用 PIE.htc
- 能选择日期范围js控件