問題一覧 > 通常問題

No.1644 Eight Digits

レベル : / 実行時間制限 : 1ケース 1.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 283
作問者 : 蜜蜂 / テスター : Mitarushi ygussany
お気に入りにしたユーザー ProblemId : 6797 / 自分の提出
問題文最終更新日: 2021-08-01 11:17:25
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
yukicoder contest 309 (順位表) の他の問題:

Problem Statement

How many of the integers that can be formed by freely rearranging the digits of $12345678$ are multiples of $K$?

Input

$K$

  • $1 \leq K \leq 87654321$
  • All inputs are integers.

Output

Output the answer, followed by a newline.

Sample

Sample 1
Input
69921
Output
8

$42861573,85723146$ and others satisfy the condition. $139842$ is a multiple of $69921$, but it is not an integer that can be formed by freely rearranging the digits of $12345678$.

Sample 2
Input
1
Output
40320

The condition is satisfied no matter how the digits are rearranged.

Sample 3
Input
20212021
Output
0

The answer may be $0$.

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