問題一覧 > 通常問題

No.311 z in FizzBuzzString

レベル : / AI推定難易度 : 167 / 実行時間制限 : 1ケース 1.500秒 / メモリ制限 : 256 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 745
作問者 : ciel
お気に入りにしたユーザー ProblemId : 848 / 自分の提出
問題文最終更新日: 2026-06-25 12:46:11
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
Advent Calendar Contest 2015 (順位表) の他の問題:

Problem Statement

For the numbers from 1 to N, convert each as follows:

  • Multiple of both 3 and 5: FizzBuzz
  • Multiple of 3: Fizz
  • Multiple of 5: Buzz
  • Otherwise: the number itself
and write them out side by side. Call this FizzBuzzString(N). Find the number of 'z' characters contained in FizzBuzzString(N).

Note: Since 64-bit integer values are used, answering in JavaScript may be difficult.
In PHP, you will likely need to use the divint function instead of /.

Input

N

N is given on one line. 1<=N<=10^18

Output

Output the number of 'z' characters on one line.

Sample

Sample 1
Input
15
Output
16

FizzBuzzString(15)="12Fizz4BuzzFizz78FizzBuzz11Fizz1314FizzBuzz", and the number of 'z' characters contained in it is 16.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。