ceil有毒啊。。用ceil一直错。

思路就是模拟吧,设当前的答案是ansx和ansy。

如果比例是小于ansx的,那么就要乘以一个倍数k1,使得a * k1 >= ansx的。

所以就用ceil(ansx / a)嘛。。然后一直wa。

ansy的同理,最后选一个倍数大的去乘就行了。

搞不清楚为什么用ceil会wa

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
#define inf (0x3f3f3f3f)
typedef long long int LL; #include <iostream>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string> void work() {
int n;
cin >> n;
LL ansx = , ansy = ;
for (int i = ; i <= n; ++i) {
LL a, b;
cin >> a >> b;
LL k1 = ;
if (a < ansx) {
// k1 = max(k1, (LL)ceil(1.0 * ansx / a)); ceil有毒?
k1 = ansx / a;
if (ansx % a != ) k1++;
}
if (b < ansy) {
// k1 = max(k1, (LL)ceil(1.0 * ansy / b));
LL t = ansy / b;
if (ansy % b != ) t++;
k1 = max(k1, t);
}
ansx = a * k1;
ansy = b * k1;
}
cout << ansx + ansy << endl;
} int main() {
#ifdef local
freopen("data.txt","r",stdin);
#endif
work();
return ;
}

C - AtCoDeerくんと選挙速報 / AtCoDeer and Election Report的更多相关文章

  1. AtCoDeerくんと選挙速報 / AtCoDeer and Election Report AtCoder - 2140 (按比例扩大)

    Problem Statement AtCoDeer the deer is seeing a quick report of election results on TV. Two candidat ...

  2. AtCoDeer and Election Report

    问题 G: AtCoDeer and Election Report 时间限制: 1 Sec  内存限制: 128 MB[提交] [状态] 题目描述 AtCoDeer the deer is seei ...

  3. 2018.09.19 atcoder AtCoDeer and Election Report(贪心)

    传送门 很有意思的一道贪心. 就是每次翻最小的倍数来满足条件. 代码: #include<bits/stdc++.h> #define ll long long using namespa ...

  4. AtCoder Regular Contest 062 E - AtCoDeerくんと立方体づくり / Building Cubes with AtCoDeer

    题目传送门:https://arc062.contest.atcoder.jp/tasks/arc062_c 题目大意: 给你\(N\)块正方形木板,每块木板四角有四种颜色(可以相同),木板中央有编号 ...

  5. 【AtCoder】ARC062

    ARC062 C - AtCoDeerくんと選挙速報 / AtCoDeer and Election Report 每次看看比率至少变成多少倍能大于当前的数 然后就把两个人的票都改成那个数 #incl ...

  6. atcoder题目合集(持续更新中)

    Choosing Points 数学 Integers on a Tree 构造 Leftmost Ball 计数dp+组合数学 Painting Graphs with AtCoDeer tarja ...

  7. FC红白机游戏列表(维基百科)

    1055个fc游戏列表 日文名 中文译名 英文版名 发行日期 发行商 ドンキーコング 大金刚 Donkey Kong 1983年7月15日 任天堂 ドンキーコングJR. 大金刚Jr. Donkey K ...

  8. Python学习 —— 爬虫入门 - 爬取Pixiv每日排行中的图片

    更新于 2019-01-30 16:30:55 我另外写了一个面向 pixiv 的库:pixiver 支持通过作品 ID 获取相关信息.下载等,支持通过日期浏览各种排行榜(包括R-18),支持通过 p ...

  9. [Arc062] Painting Graphs with AtCoDeer

    [Arc062] Painting Graphs with AtCoDeer Description 给定一张N点M边的无向图,每条边要染一个编号在1到K的颜色.你可以对一张染色了的图进行若干次操作, ...

随机推荐

  1. python之django入门

    一.搭建开发环境 使用virualenv创建虚拟python环境 pip install virtualenv [root@master djiango]# find / -name virtuale ...

  2. vim 模式下的几个快捷用法

    1.ctrl + v  (-- VISUAL BLOCK --) 选中块模式,y 复制,d 剪切,p 粘贴,Esc退出模式 2.Shift + v  (-- VISUAL LINE -- ) 快速行选 ...

  3. BZOJ_1304_[CQOI2009]叶子的染色_树形DP

    BZOJ_1304_[CQOI2009]叶子的染色_树形DP Description 给一棵m个结点的无根树,你可以选择一个度数大于1的结点作为根,然后给一些结点(根.内部结点和叶子均可)着以黑色或白 ...

  4. /boot下面文件说明

    config-3.10.0-229.el7.x86_64 <==此版本核心被编译时选择的功能与模组设定档 grub/ <==旧版 grub1 ,不需要理会这目录了! grub2/ < ...

  5. 百度地图API的第一次接触——地图事件

    0.初始化地图 var map = new BMap.Map("container"); var point = new BMap.Point(116.404, 39.915); ...

  6. 13 vue学习 package.json

    一:package.json文件详解 管理你本地安装的npm包 .定义了这个项目所需要的各种模块,以及项目的配置信息(比如名称.版本.许可证等元数据).npm install命令根据这个配置文件,自动 ...

  7. java的clone()的使用

    clone()方法的约定 首先明确的是clone()是object的方法.Cloneable接口没有任何方法,它只起到标识的作用.(java的原型模式有用到) Cloneable接口的目的是作为对象的 ...

  8. 面试总结hashmap

    考点: 1.hashing的概念 2.HashMap中解决碰撞的方法 3.equals()和hashCode()的应用,以及它们在HashMap中的重要性 4.不可变对象的好处 5.HashMap多线 ...

  9. ASP.NEt ajax 弹出窗口在页面无法关闭

    <meta http-equiv="X-UA-Compatible" content="IE=9" />     今天又有客戶投訴公司的網頁有問題. ...

  10. 百度地图API图标、文本、图例与连线

    百度地图开放平台功能强大,使用简单,为地图的自定义提供了非常方便的途径! 本文以绘制一张全国机器辐射图为例记录其基本使用方法,效果如下图: 图中包括了带图标和文本的标注,连线以及图例. 1.关于坐标 ...