比赛 |
2025.10.18 |
评测结果 |
AAAAATTTTT |
题目名称 |
WHZ 的数字 |
最终得分 |
50 |
用户昵称 |
会挽弯弓满月 |
运行时间 |
11.080 s |
代码语言 |
C++ |
内存使用 |
3.63 MiB |
提交时间 |
2025-10-18 09:47:01 |
显示代码纯文本
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll n,k;
ll tot;
ll check(int x){
if(x==0) return 1;
ll cnt=0,t;
while(x){
t=x%10;
x/=10;
if(t==0) cnt++;
}
return cnt;
}
int main(){
freopen("whz_number.in","r",stdin);
freopen("whz_number.out","w",stdout);
ll res;
while(scanf("%d%d",&n,&k)!=EOF){
tot=0;
for(long long i=n;i>=0;i--){
res=check(i);
if(tot+res>k) continue;
tot+=res;
if(tot==k){
printf("%lld\n",i);
break;
}
}
}
return 0;
}