시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB74153849372.607%

문제

FizzBuzz is a common coding interview problem. The problem is as follows:

Given a positive integer $n$, for all integers $i$ from 1 to $n$, inclusive:

  • If $i$ is divisible by both $3$ and $5$, print "FizzBuzz".
  • Otherwise, if $i$ is divisible by $3$, print "Fizz".
  • Otherwise, if $i$ is divisible by $5$, print "Buzz".
  • Otherwise, print $i$.

We are interested in a generalized version of FizzBuzz:

Given three positive integers $n$, $a$, and $b$, for all integers $i$ from 1 to $n$, inclusive:

  • If $i$ is divisible by both $a$ and $b$, print "FizzBuzz".
  • Otherwise, if $i$ is divisible by $a$, print "Fizz".
  • Otherwise, if $i$ is divisible by $b$, print "Buzz".
  • Otherwise, print $i$.

Given $n$, $a$ and $b$, how many times are "Fizz", "Buzz", and "FizzBuzz" printed for a correct implementation?

입력

The first and only line of input contains three positive integers $n$, $a$ and $b$ $(1 \le n, a, b \le 10^6.)$

출력

Output three integers: the number of times "Fizz" is printed, the number of times "Buzz" is printed, and the number of times "FizzBuzz" is printed.

예제 입력 1

17 3 5

예제 출력 1

4 2 1

예제 입력 2

10 3 3

예제 출력 2

0 0 3

출처

ICPC > Regionals > North America > Pacific Northwest Regional > 2024 ICPC Pacific Northwest Regional > Division 2 C번

  • 문제를 만든 사람: Jonathan Shen