Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define f first
- #define s second
- #define pb push_back
- #define FOR(i,a,b) for(i=(a);i<=(b);++i)
- #define FORS(i,a,b) for(i=(a);i<(b);++i)
- #define vpp vector<pair<int,int>>
- #define ll long long
- #define maxn 2005
- ll lit;
- int a,b,T;
- int main()
- {
- //freopen("parc.in","r",stdin);
- //freopen("parc.out","w",stdout);
- cin>>T;
- for(;T--;){
- cin>>lit>>a>>b;
- if(a*2<=b)
- cout<<1LL*lit*a;
- else{
- if(lit%2==1)
- cout<<1LL*(lit-1)*b/2+a;
- else
- cout<<1LL*lit*b/2;
- }
- cout<<'\n';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement