Codeforces Round #443 (Div. 2) A. Borya's Diagnosis(水水的模拟)
来源:互联网 发布:htc数据连接已断开 编辑:程序博客网 时间:2024/06/18 02:10
It seems that Borya is seriously sick. He is going visit n doctors to find out the exact diagnosis. Each of the doctors needs the information about all previous visits, so Borya has to visit them in the prescribed order (i.e. Borya should first visit doctor 1, then doctor 2, then doctor 3and so on). Borya will get the information about his health from the last doctor.
Doctors have a strange working schedule. The doctor i goes to work on the si-th day and works every di day. So, he works on days si, si + di, si + 2di, ....
The doctor's appointment takes quite a long time, so Borya can not see more than one doctor per day. What is the minimum time he needs to visit all doctors?
First line contains an integer n — number of doctors (1 ≤ n ≤ 1000).
Next n lines contain two numbers si and di (1 ≤ si, di ≤ 1000).
Output a single integer — the minimum day at which Borya can visit the last doctor.
32 21 22 2
4
210 16 5
11
In the first sample case, Borya can visit all doctors on days 2, 3 and 4.
In the second sample case, Borya can visit all doctors on days 10 and 11.
题解:
按题目意思模拟得去就过了
#include<iostream>#include<cstring>#include<stdio.h>#include<math.h>#include<string>#include<stdio.h>#include<queue>#include<stack>#include<map>#include<vector>#include<deque>#include<algorithm>#define ll long long#define INF 1008611111#define M (t[k].l+t[k].r)/2#define lson k*2#define rson k*2+1using namespace std;int main(){ int i,j,n,x,y,d=0; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d%d",&x,&y); if(d<x) { d=x; } else { while(x<=d) { x+=y; } d=x; } } printf("%d",d); return 0;}
- Codeforces Round #443 (Div. 2) A. Borya's Diagnosis(水水的模拟)
- Codeforces Round #443 (Div. 2) A. Borya's Diagnosis 水模拟
- Codeforces Round #443 (Div. 2) A. Borya's Diagnosis
- Codeforces Round #443 (Div. 2) A. Borya's Diagnosis
- Codeforces Round #443 (Div. 2)A. Borya's Diagnosis
- Codeforces 879 A Borya's Diagnosis
- A. Borya's Diagnosis
- code forces 443 A.Borya's Diagnosis(找规律)
- Codeforces Round #253 (Div. 1) A Borya and Hanabi
- Codeforces Round #346 (Div. 2) -A. Round House(模拟)
- Codeforces Round #343 (Div. 2) -A. Far Relative’s Birthday Cake(组合+模拟)
- Codeforces Round #253 (Div. 2)——Borya and Hanabi
- Codeforces Round #368 (Div. 2) A Brain's Photos(水)
- Codeforces Round #297 (Div. 2) A(模拟)
- Codeforces Round #340 (Div. 2)(A) 模拟
- Codeforces Round #107 (Div. 2) A(简单模拟)
- Codeforces Round #109 (Div. 2) A (简单模拟)
- Codeforces Round #281 (Div. 2)A(构造+暴力模拟)
- 安卓更新ui的几种方式
- 牛栏(Floyd)
- java &安卓 16进制字符串与byte互换以及int与byte类型数据转换
- MyBatis连接数据库增删改查,并使用log4j.
- spark基础之checkpoint机制
- Codeforces Round #443 (Div. 2) A. Borya's Diagnosis(水水的模拟)
- Linux虚拟机设备无法连接到它的理想主机控制器
- 六行 Python 代码切入数据分析?
- 洛谷 P1220 关路灯(DFS)
- python+Selenium自动签到实例
- ssm框架下的poi导入小记
- Python绘制时间序列数据的时序图、自相关图和偏自相关图
- Docker 安装 Nginx
- Linux 基础命令(十五)—— Linux的启动流程(CentOS 7)