Skip to content

Commit 2f076b6

Browse files
committed
Added 1353A - Most Unstable Array.cpp
1 parent 1c11999 commit 2f076b6

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

1353A - Most Unstable Array.cpp

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// ॐ नमः शिवाय
2+
#include<bits/stdc++.h>
3+
using namespace std;
4+
5+
#define ll long long
6+
#define pb push_back
7+
#define ff first
8+
#define ss second
9+
#define mp make_pair
10+
11+
// Code Written By: Vikash Patel
12+
// Codeforces Profile: https://codeforces.com/profile/vikashpatel
13+
14+
int solve(int n, int m)
15+
{
16+
if(n == 1)
17+
return 0;
18+
if(n == 2)
19+
return m;
20+
return m*2;
21+
}
22+
23+
int main()
24+
{
25+
ios_base::sync_with_stdio(0);
26+
cin.tie(0);
27+
cout.tie(0);
28+
29+
// #ifndef ONLINE_JUDGE
30+
// freopen("input.txt", "r", stdin);
31+
// freopen("/Users/vikash/Desktop/output.txt", "w", stdout);
32+
// #endif
33+
34+
int t;
35+
cin>>t;
36+
while(t--)
37+
{
38+
int n, m;
39+
cin>>n>>m;
40+
cout<<solve(n, m)<<endl;
41+
}
42+
return 0;
43+
}

0 commit comments

Comments
 (0)