### better_than_tourist's blog

By better_than_tourist, 11 days ago,

hello, codeforce!!!1!

i have a hard question for you, can you please helpp me????

question is: how to find if a number called n is even or odd???? my code is:

# if (n == 4) cout << "EVEN";

if (n == 5) cout << "ODD";
if (n == 6) cout << "EVEN";
if (n == 7) cout << "ODD";
if (n == 8) cout << "EVEN";
if (n == 9) cout << "ODD";
if (n == 10) cout << "EVEN";
if (n == 11) cout << "ODD";
if (n == 12) cout << "EVEN";
if (n == 13) cout << "ODD";
if (n == 14) cout << "EVEN";
if (n == 15) cout << "ODD";
}


it works for example, but gives wrong answer for n = 100000, what is wrong???? please helppp

• -30

 » 11 days ago, # |   -6 Here is a dp approach, dp[i] denotes if the ith number is odd or even. Now, the recurrence relaion is dp[i]=dp[i-2]