結果
問題 | No.1580 I like Logarithm! |
ユーザー | kiyoshi0205 |
提出日時 | 2021-07-02 21:55:27 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 20 ms / 2,000 ms |
コード長 | 380 bytes |
コンパイル時間 | 3,795 ms |
コンパイル使用メモリ | 229,620 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-29 11:27:33 |
合計ジャッジ時間 | 5,436 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 39 |
ソースコード
#include<bits/stdc++.h> using namespace std; #include<atcoder/all> using namespace atcoder; using mint=modint1000000007; #define rep(i,N) for(int i=0;i<N;++i) long long A,N; string s; mint ans; int main(){ cin>>A>>s; N=s.size(); mint m=A; rep(i,N-1)ans+=(m.pow(i+1)-m.pow(i))*i; mint x; rep(i,N)x=x*A+s[i]-'0'; ans+=(x-m.pow(N-1)+1)*(N-1); cout<<ans.val()<<endl; }