aboutsummaryrefslogtreecommitdiff
path: root/store/works/life/chuanzhi-cup/practice-contest/1.cpp
blob: 1a0d88eb65304a675d21413b3fa1f8a05f12bed4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>

int main() {
  int n;
  std::cin >> n;

  int count = 0;

  for (int i = 1; i <= n; i++) {
    int num = i;
    int sum = 0;
    while (num != 0) {
      sum += num % 10;
      num /= 10;

      if (sum > 9)
        break;
    }

    if (sum == 9)
      count++;
  }

  std::cout << count;

  return 0;
}