fork(6) download
  1. #include<stdio.h>
  2.  
  3. int main(){
  4. long long int x,i,a,b,t,h,arm;
  5. scanf("%lld",&x);
  6. for(i=0;i<x;i++){
  7. scanf("%lld %lld",&a,&b);
  8. if(a==0||b==0)
  9. printf("0\n");
  10. else{
  11. t=1;
  12. h=a+3;
  13. arm=b+2;
  14. while(1){
  15. if(h>5&&arm>10){
  16. h=h-2;
  17. arm=arm-8;
  18. t=t+2;
  19. }else if(h>20&&arm<=10){
  20. h=h-17;
  21. arm=arm+7;
  22. t=t+2;
  23. }else {
  24. printf("%lld\n",t);
  25. break;
  26. }
  27. }
  28. }
  29. }
  30. return 0;
  31. }
Time limit exceeded #stdin #stdout 5s 2052KB
stdin
Standard input is empty
stdout
Standard output is empty