五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

Leetcode1175. Prime Arrangements

2023-01-02 16:13 作者:您是打尖兒還是住店呢  | 我要投稿


Return the number of permutations of 1 to?n?so that prime numbers are at prime indices (1-indexed.)

(Recall that an integer?is prime if and only if it is greater than 1, and cannot be written as a product of two positive integers?both smaller than it.)

Since the answer may be large, return the answer?modulo?10^9 + 7.

?

Example 1:

Input: n = 5

Output: 12

Explanation: For example [1,2,5,4,3] is a valid permutation, but [5,2,3,4,1] is not because the prime number 5 is at index 1.

Example 2:

Input: n = 100

Output: 682289015

寫個for循環(huán)不會溢出,單獨寫個函數(shù),求階乘的,就會溢出,呵呵,不過在本機自己電腦上是可以運行的。

?

Constraints:

  • 1 <= n <= 100


Runtime0 ms

Beats

100%

Memory38.9 MB

Beats

94.38%

Click to check the distribution chart


Leetcode1175. Prime Arrangements的評論 (共 條)

分享到微博請遵守國家法律
东乡县| 泸西县| 卢龙县| 盐山县| 鄯善县| 四川省| 乐清市| 泗水县| 弋阳县| 新巴尔虎左旗| 永年县| 塘沽区| 汉寿县| 中方县| 新龙县| 达拉特旗| 津南区| 盐源县| 扶绥县| 赤壁市| 台前县| 建阳市| 上栗县| 隆化县| 临城县| 砚山县| 原阳县| 休宁县| 安平县| 秦安县| 江山市| 浪卡子县| 南澳县| 永济市| 木兰县| 临桂县| 武隆县| 台江县| 姜堰市| 延安市| 合肥市|