結果
問題 | No.2865 Base 10 Subsets 2 |
ユーザー |
|
提出日時 | 2024-08-31 12:48:41 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,012 bytes |
コンパイル時間 | 1,100 ms |
コンパイル使用メモリ | 116,940 KB |
最終ジャッジ日時 | 2025-02-24 03:31:12 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
ソースコード
#include<iostream> #include<string> #include<queue> #include<vector> #include<cassert> #include<random> #include<set> #include<map> #include<cassert> #include<unordered_map> #include<bitset> #include<numeric> #include<algorithm> using namespace std; typedef long long ll; const int inf=1<<30; const ll INF=1LL<<62; typedef pair<int,ll> P; typedef pair<int,P> PP; const ll MOD=998244353; const int dy[]={0,1,0,-1}; const int dx[]={1,0,-1,0}; int main(){ ll N,K; cin>>N>>K; string sN=to_string(N); int len=sN.size(); K--; string ans=""; for(int i=0;i<len;i++){ ll n=1; for(int j=i+1;j<len;j++){ int c=sN[j]-'0'; n*=(c+1); } // cout<<"i="<<i<<",n="<<n<<endl; int x=0; for(int j=1;j<=(sN[i]-'0');j++){ if(K>=n){ K-=n; x=j; }else{ break; } } ans=ans+to_string(x); } cout<<stoll(ans)<<endl; }