Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define test int t; cin>>t; while (t--)
- #define ll long long int
- #define sc(a) scanf("%lld",&a)
- #define sc2(a,b) scanf("%lld %lld",&a,&b)
- int main()
- {
- ll a,c,d,e,f,i,j,k,l,n,m;
- test
- {
- cin>>n>>m;
- if(n==1) cout<<0<<endl;
- else if(n==2) cout<<m<<endl;
- else cout<<2*m<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment