Advertisement
Guest User

Untitled

a guest
Aug 28th, 2014
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. long long Divisor(int a)
  6. {
  7. int counter = 0;
  8.  
  9. int square = sqrt(a);
  10.  
  11. for(int k = 1; k <= square ; k++){
  12.  
  13. if(a%k==0){
  14. counter = counter + 2;
  15. }
  16. }
  17. if (square * square == a) {
  18. counter--;
  19. }
  20. cout<<counter<<endl;
  21. return counter;
  22.  
  23. }
  24. int main()
  25. {
  26. for(int b = 1; b < 10000000; b++)
  27. {
  28. if(Divisor(b*(b+1)/2)>= 500){
  29.  
  30. cout<<b<<endl;
  31. cout<<b*(b+1)/2<<endl;
  32.  
  33. break;
  34. }
  35.  
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement