시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 9 | 4 | 4 | 100.000% |
Quido has lunch in Hugo’s restaurant every day. He likes the restaurant because all of its prices are expressed as integers, and for each possible price (i.e. \$1, \$2, \$3, etc.) there is at least one beverage and at least one main dish on the menu. Every day there are three entries printed on Quido’s lunch bill: the beverage price, the main dish price, and the total price. Hugo knows of Quido’s interest in computational problems and he offered Quido a free dessert each time his lunch bill meets the following three constraints:
Quido is on a budget and he pays the same price for his lunch every day. How many times can he have a free dessert?
The input consists of a single line with one integer representing the price P which Quido pays for each lunch. The value of P is positive and less than 1018.
Output the maximum number of times Quido can have a free dessert at Hugo’s restaurant, provided that the price of his lunch is always P. Next, the possible bills which result in a free dessert are listed in ascending order with respect to the beverage price. Each bill consists of the price of the beverage followed by the price of the main dish. For simplicity, the value P, which is always the same, is not included in the bill.
If there are more than 5 000 possible bills, then output only the first 5 000 bills (but still report the total number of possible bills before the list of bills).
37
4 8 29 9 28 11 26 15 22
30014
7 85 29929 88 29926 785 29229 788 29226 7785 22229 7788 22226 7789 22225
202020202020202058
3 7676767676767667 194343434343434391 37373737373737397 164646464646464661 67676767676767667 134343434343434391
ICPC > Regionals > North America > North America Qualification Contest > ACM-ICPC North America Qualifier 2016 F번