比赛 |
2025.10.18 |
评测结果 |
AAATTTTTTT |
题目名称 |
WHZ 的数字 |
最终得分 |
30 |
用户昵称 |
梦那边的美好TT |
运行时间 |
14.089 s |
代码语言 |
C++ |
内存使用 |
3.53 MiB |
提交时间 |
2025-10-18 11:37:12 |
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int count_zero(ll x) {
if(x==0)return 1;
int cnt=0;
while(x) {
if(x%10==0)cnt++;
x/=10;
}
return cnt;
}
ll total_zero(ll a,ll b) {
ll res=0;
for(ll i=a; i<=b; i++)res+=count_zero(i);
return res;
}
int main() {
freopen("whz_number.in","r",stdin);
freopen("whz_number.out","w",stdout);
ll n;
int k;
while(scanf("%lld%d",&n,&k)==2) {
ll ans=0;
for(ll m=n; m>=0; m--) {
ll zeros=total_zero(m,n);
if(zeros==k) {
ans=m;
break;
}
}
printf("%lld\n",ans);
}
return 0;
}