結果
| 問題 | No.573 a^2[i] = a[i] | 
| コンテスト | |
| ユーザー |  mkawa2 | 
| 提出日時 | 2020-05-24 12:46:53 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 363 ms / 2,000 ms | 
| コード長 | 1,238 bytes | 
| コンパイル時間 | 184 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 18,816 KB | 
| 最終ジャッジ日時 | 2024-10-11 04:12:01 | 
| 合計ジャッジ時間 | 6,819 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 47 | 
ソースコード
from operator import itemgetter
from itertools import *
from bisect import *
from collections import *
from heapq import *
import sys
sys.setrecursionlimit(10 ** 6)
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def SI(): return sys.stdin.readline()[:-1]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
int1 = lambda x: int(x) - 1
def MI1(): return map(int1, sys.stdin.readline().split())
def LI1(): return list(map(int1, sys.stdin.readline().split()))
p2D = lambda x: print(*x, sep="\n")
dij = [(1, 0), (0, 1), (-1, 0), (0, -1)]
md = 10 ** 9 + 7
n_max = 100005
fac = [1]
for i in range(1, n_max + 1): fac.append(fac[-1] * i % md)
ifac = [1] * (n_max + 1)
ifac[n_max] = pow(fac[n_max], md - 2, md)
for i in range(n_max - 1, 1, -1): ifac[i] = ifac[i + 1] * (i + 1) % md
def nCr(com_n, com_r):
    if com_n < com_r: return 0
    return fac[com_n] * ifac[com_r] % md * ifac[com_n - com_r] % md
def main():
    n=II()
    ans=0
    for i in range(1,n+1):
        cur=nCr(n,i)*pow(i,n-i,md)%md
        ans=(ans+cur)%md
    print(ans)
main()
            
            
            
        