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

Автор fakeofakeov, история, 3 года назад, По-английски

Today I tried to write a comment and I discovered that I need to wait 10 minutes after the previous comment. I think that it is bad for the communication. Or only I have this problem?

Полный текст и комментарии »

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

Автор fakeofakeov, история, 3 года назад, По-английски

Last week I found a difficult problem. In standard input there are two numbers A and B. I need to output sum A + B. I solve this problem

A, B = map(int, input().split())
ANS = 0
for i in range(A):
    ANS += 1
for i in range(B):
    ANS += 1
print(ANS)

But then I found more difficult problem. In this problem A can be < 0. Please help me with this difficult problem. upd: Now I know how to solve this problem, but it works very slow. I have heard about solution O(B). Does anybody know it?

Полный текст и комментарии »

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