模拟题,没什么好说的23333。
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <algorithm>
#include <deque>
#include <iostream>
#include <string>
#include <math.h>
using namespace std;
int n, L, a;
int ans;
int temp1[100000 + 5];
int temp2[100000 + 5];
int main() {
scanf("%d %d %d", &n, &L, &a);
for (int i = 0;i < n;++i) {
scanf("%d %d", &temp1[i], &temp2[i]);
}
int first = temp1[0];
int last = temp1[n - 1] + temp2[n - 1];
if (first >= a) {
ans += (first / a);
}
if ((L - last) >= a) {
ans += ((L - last) / a);
}
for (int i = 1;i <= n - 1;++i) {
if ((temp1[i] - (temp1[i - 1] + temp2[i - 1])) >= a) {
ans += ((temp1[i] - (temp1[i - 1] + temp2[i - 1])) / a);
}
}
printf("%d\n", ans);
//system("pause");
return 0;
}