fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int numdivisors(int n) {
  5. int i = 1, t = 1, c = 0;
  6. while(++i <= n) {
  7. c = 1;
  8. while(n % i == 0) {
  9. n /= i;
  10. c++;
  11. }
  12. t *= c;
  13. }
  14. return t;
  15. }
  16.  
  17. int main() {
  18. int i = 1;
  19. while(numdivisors((i * (i + 1)) / 2) < 500) i++;
  20. cout << ((i * (i + 1)) / 2) << endl;
  21. }
Success #stdin #stdout 0.5s 2724KB
stdin
Standard input is empty
stdout
76576500