WEBSITE RETURNED, HOWEVER SUBMIT QUANTITY IS RESTRICTED PER DAY TO VERY LITTLE (UNDER JUDGE0 NEW POLICY, API PROVIDER). Therefore it is very much for you to pay attention TEST CAREFULLY CODE BEFORE SUBMIT.

Candy sale

Threads:
Lee has an infinite number of candy bags in turn 6, 9 and 20 the candy. Have 1 the customer wants to buy n candies, Lee wants to sell as many bags of candy as possible. Help Lee figure out the maximum number of candy bags sold, biết rằng cô sẽ không được bán lẻ từng cây kẹo. Nếu không thể bán đủ kẹo trả về -1.

For example:

Với n = 18 thì sellCandies(n) = 3.
Explain: ta có thể bán 3 túi 6.
Với n = 77 thì sellCandies(n) = 10.
Explain: ta có thể bán 8 túi 6, 1 túi 9 and 1 túi 20.
Với n = 63 thì sellCandies(n) = 10.
Explain: ta bán 9 túi 6 and 1 túi 9.

Input: A unique number n, n <= 10^7
Output: Số túi kẹo tối đa bán được
For example:

input:
6
output:
1

You are not logged in? Log in to Submit Now!

Add a Comment