Source code for submission s506

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. int 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. pocet++;
  31. }
  32. x++;
  33. }
  34. y = 0;
  35. x = 0;
  36. cout << pocet << "\n";
  37. pocet = 0;
  38. }
  39.  
  40. return 0;
  41. }
  42.  

Diff to submission s482

f1.cpp

--- c5.s482.cteam016.fl.cpp.0.f1.cpp
+++ c5.s506.cteam016.fl.cpp.0.f1.cpp
@@ -2,4 +2,5 @@
 #include <string>
 #include <cstdlib>
+#include <cstdio>
 
 using namespace std;
@@ -11,7 +12,7 @@
  string input;
 
-
- while(cin >> input)
+ while (cin)
  {
+  cin >> input;
   n = atoi(input.c_str()+2);
   x = n+1;