ABC解説

デンソークリエイトプログラミングコンテスト2022 Winter(AtCoder Beginner Contest 280)

A. Pawn on a Grid

import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    h, w = list(map(int, input().rstrip('\n').split()))
    ans = 0
    for i in range(h):
        ans += str(input().rstrip('\n')).count("#")
    print(ans)


if __name__ == '__main__':
    solve()

B. Inverse Prefix Sum

import sys


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


if __name__ == '__main__':
    solve()

C. Extra Character

import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    s = str(input().rstrip('\n'))
    t = str(input().rstrip('\n'))
    for i in range(len(s)):
        if s[i] != t[i]:
            print(i + 1)
            exit()
    print(len(t))


if __name__ == '__main__':
    solve()

-ABC解説