LoginSignup
0
0

More than 1 year has passed since last update.

LINE Verda プログラミングコンテスト (AtCoder Beginner Contest 263) 不参戦記

Last updated at Posted at 2022-08-06

LINE Verda プログラミングコンテスト (AtCoder Beginner Contest 263) 不参戦記

ABC263A - Full House

書くだけ.

from collections import Counter

A, B, C, D, E = map(int, input().split())

if sorted(Counter([A, B, C, D, E]).values()) == [2, 3]:
    print('Yes')
else:
    print('No')

ABC263B - Ancestor

書くだけ.

N, *P = map(int, open(0).read().split())

d = {}
for i in range(N - 1):
    d[i + 2] = P[i]

result = 0
x = N
while x != 1:
    x = d[x]
    result += 1
print(result)

ABC263C - Monotonically Increasing

どうすれば良いのかはすぐわかるのに、書こうとするとなかなか上手くいかないのは、戻って続きをやる(ためにステートを戻す)みたいな再帰的な入れ子構造が難しいからか. 関数を使ってストレートに書いても良い気がするが、リストをスタックとして使って書けた.

N, M = map(int, input().split())

a = [0]
while len(a) != 0:
    a[-1] += 1
    if a[-1] > M:
        a.pop()
        continue
    if len(a) == N:
        print(*a)
    else:
        a.append(a[-1])
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0