LCC '21 Contest 2 S1 - Oscar's Fizz Buzz

View as PDF

Submit solution

Points: 3
Time limit: 0.5s
Memory limit: 64M

Author:
Problem type

Oscar has a coding interview tomorrow, so he's preparing by solving Fizz Buzz.

The problem statement reads:

"Print out a list of numbers from 1 to N, but replace multiples of 3 with fizz, multiples of 5 with buzz, and multiples of both with fizzbuzz."

Since the problem is too easy for him, he thinks of a harder (but related) problem statement:

"If the fizzbuzz program runs for the input N (1 \le N \le 10^{11}), how many numbers from 1 to N are replaced by fizz/buzz/fizzbuzz?"

He wants the answer to fizz, buzz, and fizzbuzz separately.

Input Specification

The first and only line of input will contain N (1 \le N \le 10^{11}).

Note: N may not fit in a 32-bit integer.

Output Specification

The first and only line of output should contain three space-separated integers: the answer for fizz, buzz, and fizzbuzz respectively.

Sample Input

20

Sample Output

5 3 1

Explanation

3, 6, 9, 12, and 18 are replaced by fizz. 5, 10, and 20 are replaced by buzz. 15 is replaced by fizzbuzz.


Comments

There are no comments at the moment.