Source code for submission s1202

Go to diff to previous submission

mosquito.c

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. void solv(int a, int b,int c,int d,int e,int f,int g)
  5. {
  6. if (g == 0)
  7. {
  8.  
  9. printf("%i\n", a);
  10. return;
  11. }
  12.  
  13. int na, nb, nc;
  14. na = b/f;
  15. nb = c/e;
  16. nc = a*d;
  17. if (na < 0)
  18. na = 0;
  19. if (nb < 0)
  20. nb = 0;
  21. if (nc < 0)
  22. nc = 0;
  23.  
  24. solv(na,nb,nc,d,e,f,g-1);
  25.  
  26. return;
  27. }
  28.  
  29. void solve()
  30. {
  31. int a,b,c,d,e,f,g,h;
  32. a = ~0;
  33. scanf("%i %i %i %i %i %i %i", &a, &b,&c,&d,&e,&f,&g);
  34.  
  35. solv(a,b,c,d,e,f,g);
  36.  
  37. if (a == ~0)
  38. exit(0);
  39.  
  40. }
  41.  
  42. void tryend()
  43. {
  44.  
  45. if (feof(stdin)){
  46. exit(0);
  47. }
  48. }
  49.  
  50.  
  51. int main()
  52. {
  53.  
  54. while(1) {
  55.  
  56.  
  57. solve();
  58.  
  59.  
  60.  
  61. tryend();
  62.  
  63. }
  64.  
  65. }
  66.  

Diff to submission s682

mosquito.c