题解 | #数位五五#
数位五五
https://www.nowcoder.com/practice/4306996b0a534178b90b3514a8b30028
#include <stdio.h> #include <math.h> int fun(int a, int b) { int x; int m; int count=0; for(x=a;x<=b;x++) { m=x/10000; m=m+(x%10000)/1000; m=m+(x%1000)/100; m=m+(x%100)/10; m=m+x%10; if(m%5==0) { count++; } } // printf("%d\n",count); return count; } int main() { int a, b; int out; scanf("%d %d", &a, &b); printf("%d",out=fun(a,b)); return 0; }