結果
問題 | No.1260 たくさんの多項式 |
ユーザー |
![]() |
提出日時 | 2020-10-16 22:35:12 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 326 ms / 2,000 ms |
コード長 | 595 bytes |
コンパイル時間 | 321 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 76,032 KB |
最終ジャッジ日時 | 2024-07-20 22:55:29 |
合計ジャッジ時間 | 12,761 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 61 |
ソースコード
N = int(input()) def sqrt(n): x = 1 << (n.bit_length() + 1) // 2 y = (x + n // x) // 2 while y < x: x = y y = (x + n // x) // 2 return x def ra(k): a, b = N // (k + 1) + 1, N // k return (2 * N - k * (a + b - 2)) * (b - a + 1) // 2 def calc(a): s = 1 n = N while s <= N: s *= a re = 0 while s: re += n // s n %= s s //= a return re P = 10 ** 9 + 7 r = sqrt(N - 1) - 1 rr = N // (r + 1) ans = 0 for i in range(2, rr + 1): ans += calc(i) for i in range(1, r + 1): ans += ra(i) print(ans % P)