【Codeforces Round #443 (Div. 2) A】Borya's Diagnosis
2024-08-29 11:32:11
【链接】 我是链接,点我呀:)
【题意】
在这里输入题意
【题解】
模拟
【代码】
#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;
}
最新文章
- 记录android显示流程
- Ueditor 编译发布后无法使用上传图片、附件等功能
- 初学UML——用例图
- 转:Connection: close和Connection: keep-alive有什么区别?
- NSEnumerator
- EDS 14.0 dtc:commmand not found
- P1912: [Apio2010]patrol 巡逻
- HDU 5328 Problem Killer(水题)
- Java RandomAccessFile的使用(转载的文章,出处http://www.2cto.com/kf/201208/149816.html)
- 登陆用户怎样获取验证码和保存用户到cookie中
- CreateThread函数
- .net core 11
- Unity 打包总结和资源的优化和处理
- 4.2 PCIe体系结构的组成部件
- Oracle 重建控制文件一例
- 【测试工程师面试】 记录XX银行面试
- 【转】drop、truncate和delete的区别
- 微信 H5 支付流程以及一些坑
- (转)开源项目miaosha(下)
- Unity3D 重写下拉菜单/Dropdown组件、开启每个按钮可用