Advertisement
Alhiris

Untitled

Feb 19th, 2019
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define f first
  4. #define s second
  5. #define pb push_back
  6. #define FOR(i,a,b) for(i=(a);i<=(b);++i)
  7. #define FORS(i,a,b) for(i=(a);i<(b);++i)
  8. #define vpp vector<pair<int,int>>
  9. #define ll long long
  10. #define maxn 2005
  11.  
  12. ll lit;
  13. int a,b,T;
  14.  
  15. int main()
  16. {
  17.     //freopen("parc.in","r",stdin);
  18.     //freopen("parc.out","w",stdout);
  19.     cin>>T;
  20.     for(;T--;){
  21.         cin>>lit>>a>>b;
  22.         if(a*2<=b)
  23.             cout<<1LL*lit*a;
  24.         else{
  25.             if(lit%2==1)
  26.                 cout<<1LL*(lit-1)*b/2+a;
  27.             else
  28.                 cout<<1LL*lit*b/2;
  29.         }
  30.         cout<<'\n';
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement