結果

問題 No.1809 Divide NCK
ユーザー Nzt3
提出日時 2022-01-14 23:03:05
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 325 bytes
コンパイル時間 1,668 ms
コンパイル使用メモリ 166,248 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-20 13:41:56
合計ジャッジ時間 2,934 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int main(){
    long long N,M,K;
    cin>>N>>K>>M;
    long long ans=0,t=N;
    while(t>0){
        ans+=t/M;
        t/=M;
    }
    t=N-K;
    while(t>0){
        ans-=t/M;
        t/=M;
    }
    t=K;
    while(t>0){
        ans-=t/M;
        t/=M;
    }
    cout<<ans<<'\n';
}
0