Source code for submission s794

Go to diff to previous submission

Mosquito.java

  1. import java.io.BufferedReader;
  2. import java.io.IOException;
  3. import java.io.InputStreamReader;
  4. import java.util.Scanner;
  5.  
  6. public class Mosquito {
  7.  
  8. public static void main(String[] args) throws IOException {
  9.  
  10. int M;
  11. int P;
  12. int L;
  13. int E;
  14. int R;
  15. int S;
  16. int N;
  17. int tyden = 0;
  18.  
  19. while (true) {
  20. String radek = br.readLine();
  21.  
  22. if (radek == null) {
  23. //System.out.println("RADEK JE NULL.");
  24. break;
  25. }
  26.  
  27. Scanner sc = new Scanner(radek);
  28.  
  29.  
  30.  
  31. M = sc.nextInt(); // dospelci
  32. P = sc.nextInt(); // pocetPup
  33. L = sc.nextInt(); // pocetLarev
  34. E = sc.nextInt(); // vejce ktery naklade 1 dospelec
  35. R = sc.nextInt(); // umrtnost larev
  36. S = sc.nextInt(); // umrtnost pup
  37. N = sc.nextInt();
  38.  
  39. for (int i = 0; i < N; i++) {
  40. int pocetVajec = M * E;
  41. M = 0; // umrou dospeli
  42. M = P / S;
  43. P = L / R;
  44. L = pocetVajec;
  45. }
  46.  
  47. System.out.println(M);
  48. }
  49.  
  50. }
  51. }
  52.  

Diff to submission s754

Mosquito.java

--- c4.s754.cteam118.mosquito.java.0.Mosquito.java
+++ c4.s794.cteam118.mosquito.java.0.Mosquito.java
@@ -20,8 +20,13 @@
                 while (true) {
                         String radek = br.readLine();
+                        
+                        if (radek == null) {
+                                //System.out.println("RADEK JE NULL.");
+                                break;
+                        }
+                        
                         Scanner sc = new Scanner(radek);
 
-                        if (radek.equals(""))
-                                break;
+                        
 
                         M = sc.nextInt(); // dospelci