Source code for submission s723

Go to diff to previous submission

Mosquito.java

  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package mosquito;
  6.  
  7. import java.util.LinkedList;
  8. import java.util.List;
  9. import java.util.Scanner;
  10.  
  11. /**
  12.  *
  13.  * @author student
  14.  */
  15. public class Mosquito {
  16.  
  17. /**
  18.   * @param args the command line arguments
  19.   */
  20. public static void main(String[] args) {
  21. Scanner sc = new Scanner(System.in);
  22. String res = sc.nextLine();
  23. List<Integer> result = new LinkedList<Integer>();
  24. String[] ress = res.split(" ");
  25. int pom, m, p, l, e, r, s, n;
  26. while (!"".equals(res)){
  27. m = Integer.parseInt(ress[0]);
  28. p = Integer.parseInt(ress[1]);
  29. l = Integer.parseInt(ress[2]);
  30. e = Integer.parseInt(ress[3]);
  31. r = Integer.parseInt(ress[4]);
  32. s = Integer.parseInt(ress[5]);
  33. n = Integer.parseInt(ress[6]);
  34.  
  35. for (int i = 0; i < n; i++) {
  36. pom = m;
  37. m = Math.round(p / s);
  38. p = Math.round(l / r);
  39. l = pom*e;
  40.  
  41.  
  42. }
  43. res = sc.nextLine();
  44. result.add(m);
  45. }
  46. for (Integer string : result) {
  47. System.out.println(string);
  48. }
  49.  
  50.  
  51. }
  52. }
  53.  

Diff to submission s694

Mosquito.java

--- c4.s694.cteam124.mosquito.java.0.Mosquito.java
+++ c4.s723.cteam124.mosquito.java.0.Mosquito.java
@@ -5,4 +5,6 @@
 package mosquito;
 
+import java.util.LinkedList;
+import java.util.List;
 import java.util.Scanner;
 
@@ -19,6 +21,8 @@
         Scanner sc = new Scanner(System.in);
         String res = sc.nextLine();
+        List<Integer> result = new LinkedList<Integer>();
         String[] ress = res.split(" ");
         int pom, m, p, l, e, r, s, n;
+       while (!"".equals(res)){
         m = Integer.parseInt(ress[0]);
         p = Integer.parseInt(ress[1]);
@@ -37,6 +41,11 @@
                         
         }
+       res = sc.nextLine();
+       result.add(m);
+       }
+        for (Integer string : result) {
+            System.out.println(string);
+        }
         
-        System.out.println(m);
 
     }