Cashier

Posted karshey

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Cashier相关的知识,希望对你有一定的参考价值。

Vasya has recently got a job as a cashier at a local store. His day at work is L minutes long. Vasya has already memorized n regular customers, the i-th of which comes after ti minutes after the beginning of the day, and his service consumes li minutes. It is guaranteed that no customer will arrive while Vasya is servicing another customer.

Vasya is a bit lazy, so he likes taking smoke breaks for a minutes each. Those breaks may go one after another, but Vasya must be present at work during all the time periods he must serve regular customers, otherwise one of them may alert his boss. What is the maximum number of breaks Vasya can take during the day?

Input
The first line contains three integers n, L and a (0≤n≤105, 1≤L≤109, 1≤a≤L).

The i-th of the next n lines contains two integers ti and li (0≤ti≤L−1, 1≤li≤L). It is guaranteed that ti+li≤ti+1 and tn+ln≤L.

Output
Output one integer — the maximum number of breaks.

Input
2 11 3
0 1
1 1
Output
3
Input
0 5 2
Output
2
Input
1 3 2
1 2
Output
0

Note
In the first sample Vasya can take 3 breaks starting after 2, 5 and 8 minutes after the beginning of the day.

In the second sample Vasya can take 2 breaks starting after 0 and 2 minutes after the beginning of the day.

In the third sample Vasya can’t take any breaks.

看懂题就能做。

#include<iostream>
using namespace std;
int main()
{
	int n,m=0;
	long long int l,a,t1,t2,now=0;
	cin>>n>>l>>a;
	
	
	while(n--)
	{		
		cin>>t1>>t2;
		if(now+a<=t1) 
		{
			m=m+(t1-now)/a;
		}
		
		now=t1+t2;
		if(now>=l) break;
	}
	if(now<l)
	{
		m=m+(l-now)/a;
	}
	cout<<m;
	return 0;
}

以上是关于Cashier的主要内容,如果未能解决你的问题,请参考以下文章

Laravel Cashier - 找不到类“App\Models\User”

Laravel 7.0 Cashier - 条纹支付异常

nginx 配置rewrite

Cashier

Cashier Employment(poj1275

POJ1275 Cashier Employment