ABC解説

HHKBプログラミングコンテスト2022 Winter(AtCoder Beginner Contest 282)

A. Generalized ABC

import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    k = int(input().rstrip('\n'))
    print("".join([chr(65 + i) for i in range(k)]))


if __name__ == '__main__':
    solve()

B. Let's Get a Perfect Score

import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n, m = list(map(int, input().rstrip('\n').split()))
    s = [str(input().rstrip('\n')) for _ in range(n)]
    cnt = 0
    for i in range(n):
        for j in range(i + 1, n):
            is_ok = True
            for k in range(m):
                if s[i][k] == "x" and s[j][k] == "x":
                    is_ok = False
                    break
            cnt += is_ok
    print(cnt)


if __name__ == '__main__':
    solve()

C. String Delimiter

import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n = int(input().rstrip('\n'))
    s = list(str(input().rstrip('\n')))
    cnt = 0
    for i in range(n):
        if s[i] == "\"":
            cnt += 1
        elif s[i] == "," and cnt % 2 == 0:
            s[i] = "."
    print("".join(s))


if __name__ == '__main__':
    solve()

-ABC解説