比赛 |
2025.10.18 |
评测结果 |
AAAAAWWWWW |
题目名称 |
WHZ 的数字 |
最终得分 |
50 |
用户昵称 |
汐汐很希希 |
运行时间 |
0.581 s |
代码语言 |
C++ |
内存使用 |
11.42 MiB |
提交时间 |
2025-10-18 10:59:57 |
显示代码纯文本
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=2e6+10;
const int M=0;
const int MOD=1e9+7;
const int MAXX=2147483647;
ll n,m;
int a[N];
int main()
{
freopen("whz_number.in","r",stdin);
freopen("whz_number.out","w",stdout);
a[0]=1;
for(int i=1;i<=N;i++){
int t=i;
while(t>0){
if(t%10==0) a[i]++;
t/=10;
}
}
for(int i=1;i<=N;i++) a[i]+=a[i-1];
while(scanf("%lld%lld",&n,&m)!=EOF){
if(n>N) break;
int ma=-999;
for(int i=0;i<=n;i++)
{
int ans;
if(i!=0) ans=a[n]-a[i-1];
else ans=a[n];
if(ans==m) ma=max(ma,i);
}
cout<<ma<<endl;
}
return 0;
}