fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int n;
  5.  
  6. void sub1()
  7. {
  8. int cnt = 0;
  9. for (int i = 1; i <= n; i ++)
  10. if (n % i == 0) cnt ++;
  11. cout << cnt << '\n';
  12. }
  13.  
  14. void sub2()
  15. {
  16. int cnt = 0;
  17. for (int i = 1; i * i <= n; i ++)
  18. {
  19. if (n % i == 0)
  20. {
  21. cnt ++;
  22. if (i != n/i) cnt ++;
  23. }
  24. }
  25. cout << cnt << '\n';
  26. }
  27.  
  28. int main()
  29. {
  30. ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  31. freopen("KIENHANG.INP", "r", stdin);
  32. freopen("KIENHANG.OUT", "w", stdout);
  33.  
  34. cin >> n;
  35.  
  36. if (n <= 1e6) sub1();
  37. else sub2();
  38.  
  39. return 0;
  40. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
Standard output is empty