結果
| 問題 |
No.1809 Divide NCK
|
| コンテスト | |
| ユーザー |
ゆにぽけ
|
| 提出日時 | 2023-10-15 15:51:49 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 657 bytes |
| コンパイル時間 | 1,123 ms |
| コンパイル使用メモリ | 118,844 KB |
| 最終ジャッジ日時 | 2025-02-17 07:54:39 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 WA * 22 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cassert>
#include<cmath>
#include<ctime>
#include<iomanip>
#include<numeric>
#include<stack>
#include<queue>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<bitset>
#include<random>
using namespace std;
long long N,K,M;
long long f(long long X)
{
long long res = 0;
X /= M;
while(X) res += X,X /= M;
return res;
}
void solve()
{
cin >> N >> K >> M;
long long ans = f(N)-f(N-K)-f(K);
cout << ans << endl;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
//tanosimu
int tt = 1;
//cin >> tt;
while(tt--) solve();
}
ゆにぽけ