Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Блог пользователя scriabin

Автор scriabin, история, 23 месяца назад, По-английски
w = int(input())

if w % 2:
    print("NO")
elif w == 2:
    print("NO")
else:
    print("YES")

here is my code, does anyone have recommendations to make it faster

edit; why the downvotes, where is a place i can discuss my code and figure out improvement.

  • Проголосовать: нравится
  • -22
  • Проголосовать: не нравится

»
23 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Don't use python.It's the best way :)

  • »
    »
    23 месяца назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    thank you, i am going to use C in the future, I am learning it right now, but, I am most comfortable with python atm

    • »
      »
      »
      23 месяца назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      If you use pypy, python is enough to solve most, if not all problems on codeforces. I've used mostly python so far (even though I know c++) and it has never failed me. You should only perhaps start worrying about moving to a different language way further down the road.

      As for the speed of your code, it seems good. Maybe a faster approach could be to do w & 1 instead of w % 2, but I think pratically it will rarely make a difference.

»
23 месяца назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Cpp costs 0 ms to calculate out the answer