fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define int long long
  4. int sumdigit(int x) {
  5. int s = 0;
  6. while(x > 0) {
  7. s += x % 10;
  8. x /= 10;
  9. }
  10. return s;
  11. }
  12. signed main() {
  13. int n;
  14. cin >> n;
  15. int ans = 0;
  16. for(int i = 1; i <= n; i ++) {
  17. if(sumdigit(i) == 10) ans ++;
  18. }
  19. cout << ans;
  20. }
  21.  
Time limit exceeded #stdin #stdout 5s 5328KB
stdin
Standard input is empty
stdout
Standard output is empty