結果
問題 |
No.1580 I like Logarithm!
|
ユーザー |
|
提出日時 | 2021-07-02 22:46:15 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 765 bytes |
コンパイル時間 | 151 ms |
コンパイル使用メモリ | 81,944 KB |
実行使用メモリ | 80,356 KB |
最終ジャッジ日時 | 2024-06-29 12:38:16 |
合計ジャッジ時間 | 4,299 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 6 |
other | RE * 39 |
ソースコード
def main(): import sys input = sys.stdin.readline a = int(input()) b = list(map(int, list(input()))) ans = 0 mod = 10 ** 9 + 7 for i in range(1, len(b)): if i != len(b) - 1: ans += i * pow(a, i, mod) * (a - 1) ans %= mod else: ans += i * (b[-(i + 1)] - 1) * pow(a, i, mod) ans %= mod ########関数部分############## def Base_n_to_10(X,n): out = 0 for i in range(1,len(str(X))+1): out += int(X[-i])*pow(n,(i-1),mod) out %= mod return out#int out ############################ print((ans + (len(b) - 1) * (Base_n_to_10("".join(list(map(str, b[1:]))), a) + 1)) % mod) if __name__ == '__main__': main()