[P1980] 级数求和

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define lu unsigned long long
#define str(a,b) sprintf(a,"%llu",b)
int main(){
	lu n,x,t,rk=0;
	char*d;
	scanf("%llu %llu",&n,&x);
	lu cc(char a,lu b);
	for(t=1;t<=n;t++){
     rk+=cc(x+48,t);
     //printf("t=%lu,rk(n)=%lu\n",t,cc(x+48,t));
    }
    printf("%llu",rk);
}
lu cc(char a,lu b){
	char* tostr(lu a);
	lu t=0,rk=0;
	char*ttt=tostr(b);
	for(t=0;t<=strlen(ttt);t++){
     if(t[ttt]==a)
     rk++;
    }
    free((void*)ttt);
    return rk;
}
char* tostr(lu a){
	char *ss=(char*)malloc(sizeof(char)*a);
	str(ss,a);
	return ss;
}

建议O2

上一篇:AJAX


下一篇:python反编译工具