纯模拟能过...
#include<cstdio> #include<cctype> #include<algorithm> using namespace std; inline int read(){ char c; while(c=getchar(),!isdigit(c)); int x=c-‘0‘; while(c=getchar(),isdigit(c)) x=x*10+c-‘0‘; return x; } int main(){ int n=read(),x=read(),tot=0; for(int i=1;i<=n;i+=1){ int now=i; while(now){ if(now%10==x) tot++; now/=10; } } printf("%d",tot); return 0; }
时间: 2024-10-13 07:44:27