結果
問題 | No.681 Fractal Gravity Glue |
ユーザー | 37zigen |
提出日時 | 2020-07-03 04:42:07 |
言語 | Python3 (3.11.6 + numpy 1.26.0 + scipy 1.11.3) |
結果 |
WA
|
実行時間 | - |
コード長 | 422 bytes |
コンパイル時間 | 266 ms |
コンパイル使用メモリ | 10,940 KB |
実行使用メモリ | 7,968 KB |
最終ジャッジ日時 | 2023-10-14 09:17:27 |
合計ジャッジ時間 | 1,494 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 14 ms
7,780 KB |
testcase_01 | AC | 13 ms
7,780 KB |
testcase_02 | AC | 14 ms
7,876 KB |
testcase_03 | AC | 13 ms
7,776 KB |
testcase_04 | AC | 13 ms
7,736 KB |
testcase_05 | AC | 13 ms
7,748 KB |
testcase_06 | AC | 13 ms
7,788 KB |
testcase_07 | AC | 14 ms
7,780 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 14 ms
7,748 KB |
testcase_11 | AC | 14 ms
7,892 KB |
testcase_12 | AC | 15 ms
7,736 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 13 ms
7,820 KB |
testcase_16 | WA | - |
testcase_17 | AC | 14 ms
7,836 KB |
testcase_18 | AC | 13 ms
7,892 KB |
testcase_19 | AC | 13 ms
7,752 KB |
ソースコード
MOD=10**9+7 def G_mod(i,d): ret=i*(pow(d+1,i,MOD)-1)-(d+1)*(i*d*pow(d+1,i-1,MOD)-pow(d+1,i,MOD)+1)*pow(d,MOD-2,MOD) ret%=MOD return ret n=int(input()) b,d=map(int,input().split()) tot=G_mod(b,d) while n>0: p=0 while pow(d+1,p+1)-1<=n: p+=1 q=n//pow(d+1,p) tot-=q*(p+1+G_mod(p,d)) n-=q*pow(d+1,p) if n==pow(d+1,p)-1: n-=pow(d+1,p)-1 tot-=G_mod(p,d) print(tot)