比赛 2025.10.18 评测结果 WWWTTTTTTT
题目名称 WHZ 的数字 最终得分 0
用户昵称 zhyn 运行时间 12.198 s
代码语言 C++ 内存使用 3.52 MiB
提交时间 2025-10-18 08:41:16
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;

#define ll long long 

ll m,n;

ll col(ll x){
    ll u=0;
    if(x==0){
        return 1;
    }
    while(x!=0){
        if(x%10==0){
            u++;
        }
        x>>=1;
    }
    return u;
}


int main(){
    
    
    freopen("whz_number.in","r",stdin);
    freopen("whz_number.out","w",stdout);
    
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    while(cin>>n>>m){
        ll f=0;
        for(ll i=n;i>=0;i--){
            f+=col(i);
            if(f==m){
                cout<<i<<"\n";
                break;
            }
        }
    } 
    
    
    
    
    
    return 0;
}