QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 128 MB

#23391. 數字卡片

Statistics

有足夠多的卡片,上面分別寫著從 $1$ 到 $34$ 的整數。將其中的幾張排成一行,依序寫下上面的數字。例如,卡片如下排列時,依序寫下數字得到 $27123$。

27 | 1 | 23

後來,想根據寫下的數字重新排列卡片時,發現可能有多種排列方法。

例如,對於 $27123$,有如下六種不同的方法。

2 | 7 | 1 | 2 | 3
27 | 1 | 2 | 3
2 | 7 | 12 | 3
2 | 7 | 1 | 23
27 | 12 | 3
27 | 1 | 23

給定依序寫下的卡片上的數字,要像上面這樣反過來找出卡片的排列。請編寫程式,求出所有可能的卡片排列的數量。

輸入格式

第一行給出依序寫下的卡片上的數字,由不超過 $40$ 個數字字元組成。

輸出格式

輸出可能的卡片排列的數量。

範例

輸入格式 1

27123

輸出格式 1

6

輸入格式 2

77777777777777777777

輸出格式 2

1

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.