問題一覧 > 通常問題

No.294 SuperFizzBuzz

レベル : / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 129
作問者 : nmnmnmnmnmnmnm / テスター : uwi
お気に入りにしたユーザー ProblemId : 743 / 自分の提出
問題文最終更新日: 2026-06-26 15:41:00
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. Show the original
yukicoder contest 124 (順位表) の他の問題:

Problem Statement

A positive integer divisible by 3 is called "Fizz", and a positive integer divisible by 5 is called "Buzz".
A positive integer divisible by both 3 and 5 is apparently called "FizzBuzz".
Furthermore, a positive integer that is divisible by both 3 and 5 and consists of the digits 3 and 5 is called "SuperFizzBuzz".

For example, the 1st SuperFizzBuzz, counting from the smallest, is 555.
555 is a positive integer that is divisible by both 3 and 5 and, of the digits 3 and 5, uses only 5.

What is the N-th SuperFizzBuzz, counting from the smallest?

Input

N

N is an integer. $1 \le N \le 10000000=10^7$.

Output

Output the N-th SuperFizzBuzz on one line.
Do not forget the newline at the end.

Sample

Sample 1
Input
1
Output
555

The 1st SuperFizzBuzz is 555.

Sample 2
Input
100
Output
335355555

The 100th SuperFizzBuzz is 335355555.

Sample 3
Input
10000000
Output
5533533555333355355553555

This is the largest SuperFizzBuzz within the constraints.

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