题目链接:http://codeforces.com/contest/879/problem/A
题意:n个医生,要求依次序访问每个医生,每个医生第si,si+di si+2di....si+ndi天工作,问完全访问需要的最少时间
思路:水题模拟下就好
AC代码:
#include <stdio.h>
typedef struct node {
int s;
int d;
}doctor;
doctor doctors[1010];
int main() {
int n;
scanf("%d",&n);
for (int i = 0; i < n;i++) {
scanf("%d %d",&(doctors[i].s), &(doctors[i].d));
}
int mindays = doctors[0].s;
for (int i = 1; i < n;i++) {
int currentday = doctors[i].s;
while (currentday <= mindays) {
currentday += doctors[i].d;
}
mindays = currentday;
}
printf("%d\n",mindays);
}