⌨️

[AtCoder]ABC-346|B - Piano

2024/04/05に公開

設問ページ

提出結果

def getIntMap():
    return map(int, input().split())


def main():
    s = 'wbwbwwbwbwbw'
    w, b = getIntMap()
    wb = w + b

    # w + b -> max:200
    sa = s * 20

    r = False
    # 始点をずらして12パターン
    for i in range(12):
        sl = sa[i:i+wb]
        if w == sl.count('w') and b == sl.count('b'):
            r = True
            break

    print('Yes' if r else 'No')


if __name__ == "__main__":
    main()

Discussion