ABC解説

AtCoder Beginner Contest 285

A. Edge Checker 2

import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    a, b = list(map(int, input().rstrip('\n').split()))
    print("Yes" if a * 2 == b or a * 2 + 1 == b else "No")


if __name__ == '__main__':
    solve()

B. Longest Uncommon Prefix

import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n = int(input().rstrip('\n'))
    s = str(input().rstrip('\n'))
    for i in range(1, n):
        mx = 0
        for j in range(n-i):
            if s[j] == s[j + i]:
                break
            else:
                mx = max(mx, j + 1)
        print(mx)


if __name__ == '__main__':
    solve()

C. abc285_brutmhyhiizp

import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    s = list(str(input().rstrip('\n')))
    ans = 0
    for i in range(len(s)):
        ans += pow(26, i) * (ord(s[-i-1]) - 64)
    print(ans)


if __name__ == '__main__':
    solve()

-ABC解説