結果

問題 No.3355 対数の整数部分
コンテスト
ユーザー t98slider
提出日時 2025-11-14 21:24:45
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 418 bytes
コンパイル時間 1,580 ms
コンパイル使用メモリ 194,232 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-11-14 21:24:57
合計ジャッジ時間 2,541 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

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

template<typename T>
T MUL(T a, T b){
    T res;
    return __builtin_mul_overflow(a, b, &res)? std::numeric_limits<T>::max() : res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, m;
    cin >> n >> m;
    ll ans = 0, v = 1;
    while(MUL(v, n) <= m){
        v = MUL(v, n);
        ans++;
    }
    cout << ans << '\n';
}
0