为什么超时???
查看原帖
为什么超时???
1241841
woyuan楼主2024/12/3 13:32
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a=0,b=0,sum=0,temp;
	cin>>a>>b;
	for (int c = a; c <= b; ++c)
	{
		temp = c;
		while(temp>=1)
		{
			if(temp%10==2)
			sum++;
			else
			temp/=10;	
		}
	}
	cout<<sum;
    return 0;
}
2024/12/3 13:32
加载中...