Source code for submission s830

Mosquito.java

  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5.  
  6. import java.util.*;
  7. import java.math.*;
  8. import java.io.*;
  9. import java.text.*;
  10.  
  11. public class Mosquito {
  12.  
  13. static String line, newline;
  14. static long pos;
  15. static StringTokenizer st;
  16.  
  17. /**
  18.   * @param args the command line arguments
  19.   */
  20. public static void main(String[] args) throws IOException {
  21. int m, p, l, e, r, s, n, mosk = 0;
  22. while ((line = br.readLine()) != null) {
  23.  
  24. st = new StringTokenizer(line);
  25. m = Integer.valueOf(st.nextToken());
  26. p = Integer.valueOf(st.nextToken());
  27. l = Integer.valueOf(st.nextToken());
  28. e = Integer.valueOf(st.nextToken());
  29.  
  30. r = Integer.valueOf(st.nextToken());
  31. s = Integer.valueOf(st.nextToken());
  32.  
  33. n = Integer.valueOf(st.nextToken());
  34.  
  35. if (n % 3 == 0) {
  36. mosk = m;
  37.  
  38. }
  39. if (n % 3 == 1) {
  40. mosk = (l / r) / s;
  41. n = n - 2;
  42. }
  43. if (n % 3 == 2) {
  44. mosk = (p) / s;
  45. n = n - 1;
  46. }
  47. for (int i = 1; i <= n; i = i + 3) {
  48. // System.out.println(" +"+i);
  49. mosk = ((mosk * e) / r) / s;
  50.  
  51. }
  52. System.out.println(mosk);
  53. }
  54. }
  55. }
  56.  
  57.  
  58.  
  59.