fork(6) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int ans;
  5.  
  6. void rec(int pos, int before, string bil) {
  7. if (pos>10){
  8. ans++;
  9.  
  10. //hapus comment di bawah untuk melihat hasil bilangannya
  11. //cout << bil << endl;
  12. }
  13. else {
  14. for(int i=before; i<=9; i++)
  15. rec(pos+1, i, bil+to_string(i));
  16. }
  17. }
  18.  
  19. int main () {
  20. ans = 0;
  21. rec(1, 0, "");
  22. cout << ans << endl;
  23. return 0;
  24. }
Success #stdin #stdout 0.03s 4504KB
stdin
Standard input is empty
stdout
92378