[ZICO BA]が解決しましたac CLASS 2 Part 6

21800 ワード

2869)カタツムリが行きたがっている

a, b, v = list(map(int, input().split()))

day = (v-b) // (a-b)
margin = (v-b) % (a-b)

if margin > 0:
  print(day+1)
else:
  print(day)

4153)直角三角形

def isRight(compare: bool):
  return 'right' if compare else 'wrong'

while True:
  a, b, c = list(map(int, input().split()))
  if a == 0 and b == 0 and c == 0:
    break
  result = isRight((a*a + b*b == c*c) or (a*a + c*c == b*b) or (b*b + c*c == a*a))
  print(result)

4949)バランスの取れた世界

def isYes(compare: bool):
  return 'yes' if compare else 'no'

while True:
  sentence = input()
  stack = []
  openParenthesis = True

  if sentence == '.':
    break

  for character in list(sentence):
    if character == '(' or character == '[':
      stack.append(character)
    elif character == ')':
      if len(stack) > 0 and stack[len(stack)-1] == '(':
        stack.pop()
      else:
        openParenthesis = False
        break
    elif character == ']':
      if len(stack) > 0 and stack[len(stack)-1] == '[':
        stack.pop()
      else:
        openParenthesis = False
        break
  
  print(isYes(len(stack) == 0 and openParenthesis))

7568)ブロック

n = int(input())
people = []
rank = []

for index in range(0, n):
  x, y = list(map(int, input().split()))
  people.append([x, y])
  rank.append(1)

for index in range(0, n):
  for subIndex in range(0, n):
    if index == subIndex:
      continue
    if people[index][0] < people[subIndex][0] and people[index][1] < people[subIndex][1]:
      rank[index] = rank[index] + 1

print(' '.join(str(element) for element in rank))

9012)かっこ

def isYes(compare: bool):
  return 'YES' if compare else 'NO'

t = int(input())

for index in range (0, t):
  parenthesisString = input()
  isValidParenthesisString = True
  stack = []

  for parenthesis in list(parenthesisString):
    if parenthesis == '(' :
      stack.append(parenthesis)
    elif parenthesis == ')':
      if len(stack) > 0 and stack[len(stack)-1] == '(':
        stack.pop()
      else:
        isValidParenthesisString = False
        break
  
  if len(stack) > 0:
    isValidParenthesisString = False

  print(isYes(isValidParenthesisString))

10250)ACMホテル

t = int(input())

while t > 0:
  t = t - 1
  h, w, n = list(map(int, input().split()))
  floor = 1
  room = 1
  if h > 1 and w > 1:
    floor = (n-1) % h + 1
    room = (n-1) // h + 1
  elif h == 1:
    room = n
  elif w == 1:
    floor = n

  result = floor*100 + room
  print(result)