【Codeforces Round #443 (Div. 2) A】Borya's Diagnosis
【链接】 我是链接,点我呀:)
【题意】
在这里输入题意
【题解】
模拟
【代码】
#include <bits/stdc++.h>
using namespace std;
const int N = 1000;
int n;
pair <int,int> a[N+10];
int main(){
// freopen("rush.txt","r",stdin);
scanf("%d",&n);
for (int i = 1;i <= n;i++)
scanf("%d%d",&a[i].first,&a[i].second);
int now = a[1].first;
for (int i = 2;i <= n;i++){
if (now < a[i].first){
now = a[i].first;
}else{
//now >= a[i].first;
int pre = now;
int temp = now - a[i].first;
temp = (temp-1)/a[i].second + 1;
now = a[i].first + temp*a[i].second;
if (pre==now) now += a[i].second;
}
}
printf("%d\n",now);
return 0;
}
【Codeforces Round #443 (Div. 2) A】Borya's Diagnosis的更多相关文章
- 【Codeforces Round #443 (Div. 2) B】Table Tennis
[链接] 我是链接,点我呀:) [题意] n个人站在一排. 每次第一个人和第二个人打架. 输的人跑到队列的尾巴去. 然后赢的人继续在队首.和第三个人打. 谁会先赢K次. [题解] 会发现,一轮之后就一 ...
- 【Codeforces Round #443 (Div. 2) C】Short Program
[链接] 我是链接,点我呀:) [题意] 给你一个n行的只和位运算有关的程序. 让你写一个不超过5行的等价程序. 使得对于每个输入,它们的输出都是一样的. [题解] 先假设x=1023,y=0; 即每 ...
- 【Codeforces Round #432 (Div. 1) B】Arpa and a list of numbers
[链接]h在这里写链接 [题意] 定义bad list是一个非空的.最大公约数为1的序列.给定一个序列,有两种操作:花费x将一个元素删除.花费y将一个元素加1,问你将这个序列变为good list所需 ...
- 【Codeforces Round #420 (Div. 2) C】Okabe and Boxes
[题目链接]:http://codeforces.com/contest/821/problem/C [题意] 给你2*n个操作; 包括把1..n中的某一个数压入栈顶,以及把栈顶元素弹出; 保证压入和 ...
- 【Codeforces Round #420 (Div. 2) B】Okabe and Banana Trees
[题目链接]:http://codeforces.com/contest/821/problem/B [题意] 当(x,y)这个坐标中,x和y都为整数的时候; 这个坐标上会有x+y根香蕉; 然后给你一 ...
- 【Codeforces Round #420 (Div. 2) A】Okabe and Future Gadget Laboratory
[题目链接]:http://codeforces.com/contest/821/problem/A [题意] 给你一个n*n的数组; 然后问你,是不是每个位置(x,y); 都能找到一个同一行的元素q ...
- 【Codeforces Round #423 (Div. 2) C】String Reconstruction
[Link]:http://codeforces.com/contest/828/problem/C [Description] 让你猜一个字符串原来是什么; 你知道这个字符串的n个子串; 且知道第i ...
- 【Codeforces Round #423 (Div. 2) B】Black Square
[Link]:http://codeforces.com/contest/828/problem/B [Description] 给你一个n*m的格子; 里面包含B和W两种颜色的格子; 让你在这个格子 ...
- 【Codeforces Round #423 (Div. 2) A】Restaurant Tables
[Link]:http://codeforces.com/contest/828/problem/A [Description] 有n个组按照时间顺序来餐馆; 每个组由一个人或两个人组成; 每当有一个 ...
随机推荐
- java中TCP传输协议
class TcpClient { public static void main(String[] args) throws Exception { //创建client的socket服务,指定目的 ...
- HDU 1429 胜利大逃亡(续)(bfs)
胜利大逃亡(续) Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total S ...
- Dynamics CRM 2015/2016 Web API:Unbound Custom Action 和 Bound Custom Action
今天我们再来看看Bound/Unbound Custom Action吧,什么是Custom Action?不知道的小伙伴们就out了,Dynamics CRM 2013就有了这个功能啦.和WhoAm ...
- vue --- watch 高级用法
假设有如下代码: <div> <p>FullName: {{fullName}}</p> <p>FirstName: <input type=&q ...
- SKU=Stock Keeping Unit(库存量单位)。即库存进出计量的单位,可以是以件,盒,托盘等为单位
SKU=Stock Keeping Unit(库存量单位).即库存进出计量的单位,可以是以件,盒,托盘等为单位.SKU这是对于大型连锁超市DC(配送中心)物流管理的一个必要的方法.现在已经被引申为产品 ...
- channels
package main import ( "fmt" "time" "strconv") func pinger(c chan strin ...
- mvn本地执行java程序
mvn -f pom.xml compile exec:java -Dexec.classpathScope=compile -Dexec.mainClass=storm.starter.WordCo ...
- html页面中块级元素的居中
第一:在页面中使用 margin: 0 auto;居中: <div> <p>夜屋</p> </div> div { width: 100%; posit ...
- python3 时间处理
1 标记当前时间 import datetime from dateutil import tz #标记当前时间为中国时间 注意(replace 只有标记的意思没有转化的意思) datetime.da ...
- POJ 3461 Oulipo KMP算法题解
本题就是给出非常多对字符串,然后问一个字符串在另外一个字符串出现的次数. 就是所谓的Strstr函数啦. Leetcode有这道差点儿一模一样的题目. 使用KMP算法加速.算法高手必会的算法了. 另外 ...