結果

問題 No.1259 スイッチ
ユーザー trineutron
提出日時 2020-10-16 23:04:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 191 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 75,392 KB
最終ジャッジ日時 2024-07-20 23:35:02
合計ジャッジ時間 7,471 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 61
権限があれば一括ダウンロードができます

ソースコード

diff #

d=10**9+7
n,k,m=map(int,input().split())
v=pow(n,d-2,d)
x=pow(n,n-1,d)
s=0
for i in range(1,n+1):
 if k%i==0:s+=x
 x=x*(n-i)*v%d
if m==1:print(s%d)
else:print((pow(n,n,d)-s)*pow(n-1,d-2,d)%d)
0