SHARE
TWEET

Untitled

a guest Oct 17th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //! Bismillahi-Rahamanirahim.
  2. /** ========================================**
  3.  ** @Author: Md. Abu Farhad ( RUET, CSE'15)
  4.  ** @Category:
  5. /** ========================================**/
  6.  
  7. #include<bits/stdc++.h>
  8. #include<stdio.h>
  9. using namespace std;
  10.  
  11.  
  12. #define ll                  long long
  13. #define scl(n)              scanf("%lld", &n)
  14. #define scc(c)              scanf(" %c", &c);
  15. #define fr(i,n)             for (ll i=0;i<n;i++)
  16. #define fr1(i,n)            for(ll i=1;i<=n;i++)
  17. #define pfl(x)              printf("%lld\n",x)
  18. #define pb                  push_back
  19. #define l(s)                s.size()
  20. #define asort(a)            sort(a,a+n)
  21. #define tcas(i,t)           for(ll i=1;i<=t;i++)
  22.  
  23. int main()
  24. {
  25.     ll m,n,t,b,c,d,i,j,k,x,y,z,l,q,r;
  26.  
  27.  
  28.     scl(t);
  29.     tcas(x, t)
  30.     {
  31.         cin>>x>>y>>z;
  32.         ll cnt=0,ans=0;
  33.        
  34.         while(y>0 and  z>1)
  35.         {
  36.             ans+=3;
  37.             y--, z-=2;
  38.         }
  39.         while(x>0 and  y>1)
  40.         {
  41.             ans+=3;
  42.             x--, y-=2;
  43.         }
  44.  
  45.         pfl(ans);
  46.     }
  47.  
  48.     return 0;
  49. }
  50.  
  51. ///Before submit=>
  52. ///    *check for integer overflow,array bounds
  53. ///    *check for n=1
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top