Codeforces Round #443 (Div. 2) A. Borya's Diagnosis 水模拟

来源:互联网 发布:男士皮衣品牌推荐 知乎 编辑:程序博客网 时间:2024/06/03 17:04

手动模拟


#include<bits/stdc++.h>using namespace std;int n;int main() {    scanf("%d", &n);    int t = 0;    for(int i = 0; i < n; ++i) {        int s, d;        scanf("%d %d", &s, &d);        if(t < s) { t = s;}        else {            int cnt = (t - s) / d;            t = s + (cnt+1)*d;        }    }    cout << t << endl;    return 0;}


阅读全文
1 0
原创粉丝点击