258不行,似乎是精度?
查看原帖
258不行,似乎是精度?
1273558
Flax_shiep楼主2024/4/2 19:41
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
    int n,x,c=0;
    scanf("%d%d",&n,&x);
    for(int i=1;i<n+1;i++){
        for(int j=0;j<6;j++){
            if(int(i/pow(10,j))%10==x){
                c+=1;
            }
        }
    }
    printf("%d",c);
    return 0;
}
2024/4/2 19:41
加载中...