結果
| 問題 |
No.1651 Removing Cards
|
| コンテスト | |
| ユーザー |
chocorusk
|
| 提出日時 | 2021-06-19 20:47:37 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 777 bytes |
| コンパイル時間 | 3,538 ms |
| コンパイル使用メモリ | 179,668 KB |
| 最終ジャッジ日時 | 2025-01-22 10:22:55 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 RE * 1 |
| other | WA * 32 |
ソースコード
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#include <atcoder/all>
#define popcount __builtin_popcount
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int, int> P;
ll n, k;
ll solve(ll x){
if(x<=k) return x-1;
return solve(x-(x+k-1)/k)/(k-1)*k+1+solve(x-(x+k-1)/k)%(k-1);
}
int main()
{
cin>>n>>k;
cout<<solve(n)+1<<endl;
return 0;
}
chocorusk