比赛 2025.10.18 评测结果 AAAAATTTTT
题目名称 WHZ 的数字 最终得分 50
用户昵称 梦那边的美好CE 运行时间 10.767 s
代码语言 C++ 内存使用 3.53 MiB
提交时间 2025-10-18 10:32:51
显示代码纯文本
#include<bits/stdc++.h>
#define int unsigned long long
using namespace std;
int n,k;
int cnt0(int x){
	int ans=0;
	while(x){
		if(x%10==0)ans++;
		x/=10;
	}
	return ans;
}

signed main(){
	freopen("whz_number.in","r",stdin);freopen("whz_number.out","w",stdout);
	while(cin>>n>>k){
		// printf("n=%ull,k=%ull\n",n,k);
		int now=0;
		for(int i=n;i>=(int)0;i--){
			now+=cnt0(i);
			// cout<<"cnt0(i)="<<cnt0(i)<<endl;
			if(k==now||!i){
				cout<<i<<"\n";
				break;
			}
			// cout<<"i="<<i<<endl;
		}
	}
	return 0;
}