Skip to content

Commit 444c3c5

Browse files
committed
Added 1451A - Subtract or Divide.cpp
1 parent 07e21eb commit 444c3c5

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

1451A - Subtract or Divide.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// ॐ नमः शिवाय
2+
#include<bits/stdc++.h>
3+
using namespace std;
4+
#define ll long long
5+
6+
// Code Written By: Vikash Patel
7+
// Codeforces Profile: https://codeforces.com/profile/vikashpatel
8+
9+
int solve(int n)
10+
{
11+
if(n<=3)
12+
return n-1;
13+
else if(n & 1)
14+
return 3;
15+
return 2;
16+
}
17+
int main()
18+
{
19+
int t;
20+
cin>>t;
21+
while(t--)
22+
{
23+
int n;
24+
cin>>n;
25+
cout<<solve(n)<<endl;
26+
}
27+
return 0;
28+
}

0 commit comments

Comments
 (0)