Source code for submission s530

Go to diff to previous submission

f1.cpp

  1. #include <iostream>
  2. #include <string>
  3. #include <cstdlib>
  4. #include <cstdio>
  5.  
  6. using namespace std;
  7.  
  8. int main ()
  9. {
  10. unsigned long n, x, y, pocet;
  11. n = x = y = pocet = 0;
  12. string input;
  13.  
  14. while (cin)
  15. {
  16. cin >> input;
  17. n = atoi(input.c_str()+2);
  18. x = n+1;
  19. if (n == 1)
  20. {
  21. cout << 1 << "\n";
  22. continue;
  23. }
  24. while (true)
  25. {
  26. if((x*n)%(x-n)==0)
  27. {
  28. y = x*n/(x-n);
  29. if (y < x) break;
  30.  
  31. pocet++;
  32.  
  33. if (y == x) break;
  34. }
  35. x++;
  36. }
  37. y = 0;
  38. x = 0;
  39. cout << pocet << "\n";
  40. pocet = 0;
  41. }
  42.  
  43. return 0;
  44. }
  45.  

Diff to submission s520

f1.cpp

--- c5.s520.cteam016.fl.cpp.0.f1.cpp
+++ c5.s530.cteam016.fl.cpp.0.f1.cpp
@@ -8,5 +8,5 @@
 int main ()
 {
- int n, x, y, pocet;
+ unsigned long n, x, y, pocet;
  n = x = y = pocet = 0;
  string input;