結果

問題 No.573 a^2[i] = a[i]
ユーザー roarisroaris
提出日時 2019-12-20 16:16:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 282 ms / 2,000 ms
コード長 296 bytes
コンパイル時間 388 ms
コンパイル使用メモリ 86,936 KB
実行使用メモリ 85,092 KB
最終ジャッジ日時 2023-09-22 21:04:17
合計ジャッジ時間 6,502 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,348 KB
testcase_01 AC 66 ms
71,388 KB
testcase_02 AC 68 ms
70,924 KB
testcase_03 AC 67 ms
71,088 KB
testcase_04 AC 66 ms
71,048 KB
testcase_05 AC 66 ms
71,400 KB
testcase_06 AC 67 ms
71,092 KB
testcase_07 AC 67 ms
71,160 KB
testcase_08 AC 67 ms
71,168 KB
testcase_09 AC 66 ms
71,096 KB
testcase_10 AC 66 ms
71,232 KB
testcase_11 AC 67 ms
71,280 KB
testcase_12 AC 68 ms
71,324 KB
testcase_13 AC 67 ms
71,064 KB
testcase_14 AC 68 ms
71,296 KB
testcase_15 AC 67 ms
70,928 KB
testcase_16 AC 68 ms
71,388 KB
testcase_17 AC 68 ms
71,484 KB
testcase_18 AC 68 ms
71,264 KB
testcase_19 AC 67 ms
71,164 KB
testcase_20 AC 67 ms
71,240 KB
testcase_21 AC 68 ms
71,448 KB
testcase_22 AC 69 ms
71,008 KB
testcase_23 AC 67 ms
71,236 KB
testcase_24 AC 66 ms
71,164 KB
testcase_25 AC 68 ms
71,440 KB
testcase_26 AC 67 ms
71,448 KB
testcase_27 AC 67 ms
71,144 KB
testcase_28 AC 69 ms
71,064 KB
testcase_29 AC 66 ms
71,068 KB
testcase_30 AC 69 ms
71,416 KB
testcase_31 AC 68 ms
71,240 KB
testcase_32 AC 68 ms
71,148 KB
testcase_33 AC 70 ms
71,064 KB
testcase_34 AC 70 ms
71,408 KB
testcase_35 AC 73 ms
75,256 KB
testcase_36 AC 76 ms
75,260 KB
testcase_37 AC 77 ms
75,092 KB
testcase_38 AC 78 ms
75,352 KB
testcase_39 AC 87 ms
76,236 KB
testcase_40 AC 86 ms
76,488 KB
testcase_41 AC 87 ms
76,196 KB
testcase_42 AC 91 ms
76,512 KB
testcase_43 AC 89 ms
76,516 KB
testcase_44 AC 91 ms
76,192 KB
testcase_45 AC 100 ms
76,320 KB
testcase_46 AC 282 ms
85,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def inv(x):
    return pow(x, MOD-2, MOD)

def C(n, r):
    return fact[n]*inv(fact[r])*inv(fact[n-r])

N = int(input())
MOD = 10**9+7
fact = [1]

for i in range(1, N+1):
    fact.append(fact[-1]*i%MOD)

ans = 0

for i in range(N+1):
    ans += pow(i, N-i, MOD)*C(N, i)
    ans %= MOD

print(ans)
0