fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int a,b,n,s=0;
  5. scanf("%d %d %d",&n,&a,&b);
  6. for(int i=1;i<=n;i++){
  7. int t=0,r=i;
  8. while(r>0){
  9. int w=r%10;
  10. t+=w;
  11. r/=10;
  12. }
  13. if(a<=t&&b>=t)s+=i;
  14.  
  15. }
  16. printf("%d",s);
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0.01s 5276KB
stdin
10 1 2
stdout
13