Source code for submission s471

Go to diff to previous submission

fl.cpp

  1.  
  2. #include <cstdlib>
  3. #include <cstdio>
  4. #include <cstring>
  5. #include <cmath>
  6.  
  7. using namespace std;
  8.  
  9. int main() {
  10. int dm1, n;
  11. char dm2;
  12. //getchar(); getchar();
  13. while (scanf("%d%c%d", &dm1, &dm2, &n) == 3) {
  14. int total = 0;
  15. for (int i = n+1; i <= 2*n; i++) {
  16. if (!((i*n)%(i-n)) && ((i*n)/(i-n)) >= i) total++;
  17. //for (int j = i; j < 10000; j++)
  18. //total += j*n+i*n==i*j;
  19. }
  20. /*for (int i = 1; i < n; i++) {
  21. int y = i*n/(n-i);
  22. if (!(y*n%(y-n))) {
  23. if (y <= n) continue;
  24. int x = y*n/(y-n);
  25. if (x > y)
  26. total++;
  27. }
  28. }*/
  29. printf("%d\n", total);
  30. }
  31. return 0;
  32. }
  33.  

Diff to submission s452

fl.cpp

--- c5.s452.cteam033.fl.cpp.0.fl.cpp
+++ c5.s471.cteam033.fl.cpp.0.fl.cpp
@@ -13,9 +13,18 @@
         while (scanf("%d%c%d", &dm1, &dm2, &n) == 3) {
                 int total = 0;
-                for (int i = n+1; i <= n*n; i++) {
+                for (int i = n+1; i <= 2*n; i++) {
                         if (!((i*n)%(i-n)) && ((i*n)/(i-n)) >= i) total++;
                         //for (int j = i; j < 10000; j++)
                                 //total += j*n+i*n==i*j;
                 }
+                /*for (int i = 1; i < n; i++) {
+                        int y = i*n/(n-i);
+                        if (!(y*n%(y-n))) {
+                                if (y <= n) continue;
+                                int x = y*n/(y-n);
+                                if (x > y)
+                                        total++;
+                        }
+                }*/
                 printf("%d\n", total);
         }