結果

問題 No.2865 Base 10 Subsets 2
ユーザー Carpenters-Cat
提出日時 2024-08-30 22:11:00
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 441 bytes
コンパイル時間 1,914 ms
コンパイル使用メモリ 197,772 KB
最終ジャッジ日時 2025-02-24 03:06:22
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main () {
	ll N, K;
	cin >> N >> K;
	ll X = 1;
	{
		string s = to_string(N);
		for (auto& a : s) {
			X *= (a - '0') + 1ll;
		}
	}
	K --;
	if (!K) {
		puts("0");
		return 0;
	}
	stack<int> st;
	while (K) {
		ll w = ((N % 10) + 1);
		st.push(K % w);
		K /= w;
		X /= ((N % 10) + 1);
		N /= 10;
	}
	while (!st.empty()) {
		cout << st.top();
		st.pop();
	}
	cout<< endl;
}
0