Masala #0729

Xotira 16 MB Vaqt 1000 ms Qiyinchiligi 10 %
14

  

Toq or juft

Sizga \(n (n≥0)\) butun soni berilgan. U mana bu ifodaga teng:

\(n=a_1*b^{k-1}+a_2*b^{k-2}+\dots+a_{k-1}*b+a_k.\)

Bunga misol qilishimiz mumkin,
\(b=17,k=3, a=[11,15,7]\) bo'lsa,
\(n=11*17^2+15*17+7=3179+255+7=3441\).
\(N\) juft yoki toq ekanligini aniqlang.


Kiruvchi ma'lumotlar:

Birinchi qatorda ikkita butun \(b\) va \(k (2≤b≤100, 1≤k≤105)\).
Ikkinchi qatorda \(a_1,a_2, \dots ,a_k (0≤a_i≤b)\)


Chiquvchi ma'lumotlar:

Chiqish faylida yagona qatorda, agar \(n\) juft bo'lsa, "even" deb chop eting. Aks holda "odd" deb chop eting.


Misollar
# input.txt output.txt
1
13 3
3 2 7
even
2
10 9
1 2 3 4 5 6 7 8 9
odd
Izoh:

Birinchi misolda \(n=3*13^2+2*13+7=540\) demak \(n\) juft son

Ikkinchi misolda \(n=123456789\) demak \(n\) toq son

Yechimini yuborish
Bu amalni bajarish uchun tizimga kiring, agar profilingiz bo'lmasa istalgan payt ro'yxatdan o'tishingiz mumkin