結果
| 問題 | No.1580 I like Logarithm! |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-03 02:02:52 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 464 bytes |
| 記録 | |
| コンパイル時間 | 3,049 ms |
| コンパイル使用メモリ | 274,052 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-21 10:21:29 |
| 合計ジャッジ時間 | 4,969 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 39 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using std::cin;
using std::cout;
using namespace atcoder;
using mint = modint1000000007;
using std::string;
using ll = long long;
int main() {
int a;
string b;
cin >> a >> b;
int n = b.size();
reverse(b.begin(), b.end());
mint ans, mul = 1, t;
for (int i = 0; i < n; ++i) {
ans -= mul - 1;
t += mint(b[i] - '0') * mul;
mul *= a;
}
ans += t * (n - 1);
cout << ans.val() << '\n';
return 0;
}