My issue
my issue is that why is my solution wrong, i saw other’s solutions and they just did a-1 in the 2nd case, meanwhile i did a-2.
example:-
if input is 2. then output should be 0, why? since then only we get an even sum. The solution given by others gives 1 as output, but it gives a odd sum bro.
another example:-
if input is 6, then output should be 4, why? since then we get an even sum. the solution given by others will give 5 as output, but it gives a odd sum ;-; .
pls explain what am i doing wrong???
My code
#include <iostream>
using namespace std;
int main() {
int t;
cin >> t;
while(t--){
int a;
cin >> a;
if (((a+3)%4)==0){
cout<<a-1;
}
else if (((a+2)%4)==0){
cout << a-2;
}
else{
cout<<a;
}
cout << endl;
}
return 0;
}
Problem Link: CodeChef: Practical coding for everyone