結果

問題 No.1809 Divide NCK
ユーザー nyuminyusupe
提出日時 2024-09-28 02:45:40
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 430 bytes
コンパイル時間 1,721 ms
コンパイル使用メモリ 166,024 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-28 02:45:44
合計ジャッジ時間 3,146 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i< (n); i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 998244353;
const int inf = (1<<30);
const ll INF = (1ull<<62);

ll f(ll n,ll k){
    ll ans = 0;
    while(n > 0){
        ans += n/k;
        n /= k;
    }
    return ans;
}

int main(){
    ll n,k,m; cin>>n>>k>>m;
    ll t = n-k;
    cout<<f(n,m) - f(k,m) - f(t,m)<<endl;    
}
0