Ուղարկել | Բոլոր լուծումները | Լավագույն լուծումները | Վերադառնալ ցուցակին |
ACM_0072 - CAMPER |
As Happy Camper Harry pulls into his favorite campground with his family, he notices the sign: ’Camp- ground occupancy is limited to 10 days within any consecutive 20-day period.’ Harry is just starting a 28-day vacation. What is the maximum number of days he can occupy a campsite during his vacation?
We state the problem in more general terms. Suppose that 1 < L < P < V are integers. Campground occupancy is limited to L days within any consecutive P -day period. Happy Camper Harry is just starting a V -day vacation. What is the maximum number of days he can occupy a campsite during his vacation?
Input
The input will contain data for a number of test cases. For each test case, there will be one line of data, containing values of L, P and V , in that order. All input integers can be represented by signed 32-bit integers. End of data will be signaled by a line containing three zeros, which will not be processed.
Output
There will be one line of output for each test case. It will display the case number and the number of days Happy Camper Harry can occupy a campsite during his vacation. The format is illustrated by the sample output.
Examples
№ |
stdin |
stdout |
1 |
5 8 20 5 8 17 0 0 0 |
Case 1: 14 Case 2: 11 |
Ավելացրեց. | Հրանտ Հովհաննիսյան |
Ամսաթիվ. | 2014-01-07 |
Ժամանակի սահմանափակումը. | 1s |
Ծրագրի տեքստի սահմանափակումը. | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Լեզուներ. | Բոլորը բացի ASM32 ASM64 GAWK CLPS CLOJURE D ERL FSHARP FORTRAN GOSU HASK ICON ICK NEM NIM OBJC-CLANG PICO PIKE PYPY PYPY3 PY_NBC RUST SCM guile CHICKEN SED TCL WHITESPACE |
Աղբյուրը. | NA Rocky Mountain, Practice 2013.B |