fork download
  1. #include <iostream>
  2. #include<string>
  3. #include<stdio.h>
  4.  
  5.  
  6. using namespace std;
  7.  
  8. unsigned long long int Ao(unsigned int c);
  9.  
  10. int main( )
  11. {
  12.  
  13.  
  14.  
  15. unsigned int m = 6u;
  16.  
  17.  
  18.  
  19. for (int i = 0; i <= m; i++) {
  20. unsigned int a, b;
  21. unsigned long long int result = 0llu;
  22.  
  23. scanf("%u, %u\n", &a, &b);
  24.  
  25.  
  26.  
  27. for (unsigned int i = a; i <= b; i++) {
  28.  
  29. result += Ao(i); //
  30.  
  31.  
  32. }
  33.  
  34. printf("%llu\n", result);
  35. }
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46. }
  47.  
  48. unsigned long long int Ao(unsigned int c) {
  49.  
  50.  
  51. unsigned long long int count = 0llu;
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59. string S = to_string(c); // 숫자를 스트링으로 "바꿔서" 이어나감
  60.  
  61.  
  62.  
  63.  
  64.  
  65. for (unsigned long long int j = 0u; j < S.size(); j++) {
  66.  
  67. if (S[j] == '0') { // 0 찾기
  68.  
  69. count++;
  70. }
  71.  
  72.  
  73. }
  74.  
  75.  
  76. return count;
  77.  
  78.  
  79.  
  80. }
  81.  
Success #stdin #stdout 0.03s 5440KB
stdin
10 11
100 200
0 500
1234567890 2345678901
0 4294967295
-1 -1
stdout
12746
12745
12737
12717
12747
12657
0