Source code for submission s826

Go to diff to previous submission

fl.cpp

  1. #include <iostream>
  2. #include <string>
  3. #include <cstdlib>
  4. #include <cstdio>
  5. #include <vector>
  6.  
  7. using namespace std;
  8.  
  9. int main ()
  10. {
  11. unsigned long n, x, y, pocet;
  12. n = x = y = pocet = 0;
  13. string input;
  14. vector<unsigned long> pouzite;
  15. bool nasel = false;
  16.  
  17. while (cin)
  18. {
  19. cin >> input;
  20. if (input.empty()) break;
  21. n = atoi(input.c_str()+2);
  22. x = n+1;
  23. if (n == 0)
  24. {
  25. cout << 0 << "\n";
  26. continue;
  27. }
  28. if (n == 1)
  29. {
  30. cout << 1 << "\n";
  31. continue;
  32. }
  33. while (float((x*n)%(x-n)) < n+1)
  34. {
  35. if((x*n)%(x-n)==0)
  36. {
  37. y = x*n/(x-n);
  38. //if (y < x) break;
  39. nasel = false;
  40. for (vector<unsigned long>::iterator i = pouzite.begin(); i != pouzite.end(); i++)
  41. {
  42. if ((*i) == y)
  43. {
  44. nasel = true;
  45. break;
  46. }
  47. }
  48. if (!nasel)
  49. {
  50. pouzite.push_back(x);
  51. pocet++;
  52. }
  53. //pocet++;
  54.  
  55. //if (y == x) break;
  56. }
  57. x++;
  58. }
  59. y = 0;
  60. x = 0;
  61. cout << pocet << "\n";
  62. pocet = 0;
  63. pouzite.clear();
  64. }
  65. cout << "\n";
  66. return 0;
  67. }
  68.  

Diff to submission s823

fl.cpp

--- c5.s823.cteam016.fl.cpp.0.fl.cpp
+++ c5.s826.cteam016.fl.cpp.0.fl.cpp
@@ -63,4 +63,5 @@
   pouzite.clear();
  }
+ cout << "\n";
  return 0;
 }