1451A codeforces solution in cpp
by ujjal roy
#include<bits/stdc++.h>
using namespace std;
main()
{
int t,n,sum;
cin>>t;
while(t--)
{
cin>>n;
if(n<=3) cout<<n-1<<endl;
else if(n%2==0) cout<<"2"<<endl;
else cout<<"3"<<endl;
}
return 0;
}
1451A codeforces solution in cpp
by ujjal roy
#include<bits/stdc++.h>
using namespace std;
main()
{
int t,n,sum;
cin>>t;
while(t--)
{
cin>>n;
if(n<=3) cout<<n-1<<endl;
else if(n%2==0) cout<<"2"<<endl;
else cout<<"3"<<endl;
}
return 0;
}
0 Comments