ABC解説 Edit

東京海上日動プログラミングコンテスト2023(AtCoder Beginner Contest 307)

A. Weekly Records

import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n = int(input().rstrip('\n'))
    a = list(map(int, input().rstrip('\n').split()))
    print(*[sum(a[i*7:(i+1)*7]) for i in range(n)])


if __name__ == '__main__':
    solve()

B. racecar

import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n = int(input().rstrip('\n'))
    s = [str(input().rstrip('\n')) for _ in range(n)]
    for i in range(n):
        for j in range(n):
            if i != j:
                ts = s[i] + s[j]
                is_ok = True
                for k in range(len(ts)):
                    if ts[k] != ts[-k-1]:
                        is_ok = False
                        break
                if is_ok:
                    print("Yes")
                    exit()
    print("No")



if __name__ == '__main__':
    solve()

-ABC解説, Edit