样例对但提交不对,求解
  • 板块灌水区
  • 楼主oWuGI7s6
  • 当前回复3
  • 已保存回复3
  • 发布时间2024/12/7 02:35
  • 上次更新2024/12/7 11:18:31
查看原帖
样例对但提交不对,求解
1415736
oWuGI7s6楼主2024/12/7 02:35
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;
	cin>>n>>k;
	int ans=0;
	for(int i=1;i<=n;i++)
	{
	    int m=i;
	    while(m!=0)
	    {
	        if(m%10==k)
	        {
	            ans++;
	        }
	        m/=10;
	    }
	}
	return 0;
}
2024/12/7 02:35
加载中...