結果
問題 | No.1651 Removing Cards |
ユーザー |
![]() |
提出日時 | 2021-06-19 20:37:02 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 232 bytes |
コンパイル時間 | 718 ms |
コンパイル使用メモリ | 65,028 KB |
最終ジャッジ日時 | 2025-01-22 10:22:30 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 RE * 1 |
other | WA * 32 |
ソースコード
#include <iostream> using namespace std; typedef long long ll; ll n, k; ll solve(ll x){ if(x<=k) return x-1; ll y=solve(x-(x+k-1)/k); return y/(k-1)*k+1+y%(k-1); } int main() { cin>>n>>k; cout<<solve(n)+1<<endl; return 0; }