結果

問題 No.1580 I like Logarithm!
ユーザー sten_sansten_san
提出日時 2021-07-02 22:39:30
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,384 bytes
コンパイル時間 9,972 ms
コンパイル使用メモリ 422,472 KB
実行使用メモリ 8,712 KB
最終ジャッジ日時 2023-09-11 23:00:37
合計ジャッジ時間 20,330 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,712 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 1 ms
4,356 KB
testcase_04 AC 2 ms
4,356 KB
testcase_05 AC 1 ms
4,360 KB
testcase_06 AC 702 ms
4,352 KB
testcase_07 TLE -
testcase_08 AC 2 ms
4,356 KB
testcase_09 AC 32 ms
4,356 KB
testcase_10 AC 94 ms
4,356 KB
testcase_11 AC 1,346 ms
4,356 KB
testcase_12 AC 1,625 ms
4,352 KB
testcase_13 AC 795 ms
4,356 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

struct iofast_t {
    iofast_t() {
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
    }
} iofast;

struct uns_t {} uns;
template <typename Element, typename Head, typename ...Args>
auto vec(Element init, Head arg, Args ...args) {
    if constexpr (sizeof...(Args) == 0) return std::vector(arg, init);
    else return std::vector(arg, vec(init, args...));
}
template <typename Element, typename Head, typename ...Args>
auto vec(uns_t, Head arg, Args ...args) {
    return vec(Element(), arg, args...);
}

template <typename T, typename Compare = less<T>>
T &chmin(T &l, T r, Compare &&f = less<T>()) { return l = min(l, r, f); }
template <typename T, typename Compare = less<T>>
T &chmax(T &l, T r, Compare &&f = less<T>()) { return l = max(l, r, f); }

#include <boost/multiprecision/cpp_int.hpp>
using bint = boost::multiprecision::cpp_int;

#include <atcoder/modint>
using mint = atcoder::modint1000000007;

int main() {
    int a; cin >> a;

    auto b = [&] {
        string s; cin >> s;

        bint b = 0;
        for (auto c : s) {
            b *= a;
            b += c - '0';
        }

        return b;
    }();

    mint ans = 0;

    bint k = 1;
    for (int i = 0; k <= b; ++i) {
        ans += int((i * (min(b, k * a - 1) - k + 1)) % mint::mod());
        k *= a;
    }

    cout << ans.val() << endl;
}

0