問題一覧 > 通常問題

No.3178 free sort

レベル : / AI推定難易度 : 825 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 118
作問者 : Cafe1942 / テスター : tsunamayo123 kk2a sclara
お気に入りにしたユーザー ProblemId : 12337 / 自分の提出
問題文最終更新日: 2025-06-13 22:35:56
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 470 (順位表) の他の問題:

Problem Statement

You are given a positive integer $N$. Consider the digits of $N$ when written in decimal so that the most significant digit is not $0$. You may freely rearrange these digits, as long as the most significant digit does not become $0$. How many positive integers can be formed in total? Since the answer can be very large, output the answer modulo $998244353$.

(Added at $21$:$48$) Some test cases begin with a leading $0$. In every test case, the number of digits (characters) is at most $200000$. (Added at 22:26) For cases with a leading 0, output the number of ways to rearrange the digits using exactly as many 0s as the input contains, so that no 0 comes first.

Constraints

  • $1 \leq N < 10^{200000}$
  • $N$ is an integer
  • (Added at $21$:$48$) Some test cases begin with a leading $0$.

Input

$N$

Output

Output the answer modulo $998244353$.

Sample

Sample 1
Input
120
Output
4

A total of $4$ numbers can be formed: $102$ $,$ $120$ $,$ $201$ $,$ $210$.

Sample 2
Input
9
Output
1

The only number that can be formed is $9$, so there is just $1$ way.

Sample 3
Input
1942
Output
24

Sample 4
Input
1944
Output
12

Sample 5
Input
11123456789995
Output
212565247

The number of ways is $1210809600$, but you should output $212565247$, which is the remainder when divided by $998244353$.

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