P2948 [USACO09OPEN] Ski Lessons G
Description
Farmer John wants to take Bessie skiing in Colorado. Sadly, Bessie is not really a very good skier.
Bessie has learned that the ski resort is offering S (0
Input Format
\* Line 1: Three space-separated integers: T, S, and N
\* Lines 2..S+1: Line i+1 describes ski lesson i with three
space-separated integers: M\_i, L\_i, and A\_i
\* Lines S+2..S+N+1: Line S+i+1 describes ski slope i with two
space-separated integers: C\_i and D\_i.
Output Format
A single integer on a line by itself, the maximum number of runs that Bessie may ski within the time limit.
Explanation/Hint
Ski the second slope once, take the lesson, and ski the first slope 5 times before time is up: a total of 6 slopes.