fork download
  1. #include<stdio.h>
  2. int t,r,g,b,rr[100],gg[100],bb[100],max1=0,max2=0,max3=0,m,i,pos;
  3. int *c;
  4. void max()
  5. {
  6. max1=0;
  7. for(i=0;i<r;i++)
  8. if(rr[i]>max1)
  9. {
  10. max1=rr[i];
  11. pos=i;c=rr;
  12. }
  13. for(i=0;i<g;i++)
  14. if(gg[i]>max1)
  15. {
  16. max1=gg[i];
  17. pos=i;c=gg;
  18. }
  19. for(i=0;i<b;i++)
  20. if(bb[i]>max1)
  21. {
  22. max1=bb[i];
  23. pos=i;c=bb;
  24. }
  25. //return max1;
  26. }
  27. int main()
  28. {
  29.  
  30. scanf("%d",&t);
  31. while(t--)
  32. {
  33. scanf("%d",&r);
  34. scanf("%d",&g);
  35. scanf("%d",&b);
  36. scanf("%d",&m);
  37. for(i=0;i<r;i++)
  38. scanf("%d",&rr[i]);
  39. for(i=0;i<g;i++)
  40. scanf("%d",&gg[i]);
  41. for(i=0;i<b;i++)
  42. scanf("%d",&bb[i]);
  43.  
  44. //printf("%d",max());
  45. while(m>0)
  46. {
  47. max();
  48. c[pos]/=2;
  49. m--;
  50. }
  51. max();
  52. printf("%d",c[pos]);
  53. if(t)
  54. printf("\n");
  55. }
  56. }
  57.  
Success #stdin #stdout 0s 2248KB
stdin
Standard input is empty
stdout
Standard output is empty