Why it's Wrong
查看原帖
Why it's Wrong
885777
_cheems_ckr_楼主2024/5/13 22:31
#include<bits/stdc++.h>
using namespace std;
bool h(int n){
	while(n){
		if(n%10==0) return true;
		else n/=10;
	}
	return false;
}
int f(int a,int n){
    int num=0,i=1;
    while(a){
        num+=(a%n)*i;
        a/=n;
        i*=10;
    }
    return num;
}
int n,m,t=0;
int main(){
	scanf("%d%d",&n,&m);
	for(int i=n;i<=m;i++){
		if(h(f(i,5))&&h(f(i,7))&&h(f(i,9))){
			t++;
		}
	}
	cout<<t;
	return 0;
}

2024/5/13 22:31
加载中...