⌨️

[AtCoder]ABC-050|B - Contest with Drinks Easy

2022/12/20に公開約500字

設問ページ

提出結果

def getInt():
    return int(input())


def getIntList():
    return list(map(int, input().split()))


def getIntListRow(N):
    return [list(map(int, input().split())) for _ in range(N)]


def adjust(t, d):
    c = d[0]
    return d[1] - t[c - 1]


def main():
    n = getInt()
    t = getIntList()
    m = getInt()
    data = getIntListRow(m)

    for d in data:
        s = sum(t)
        print(s + adjust(t, d))


if __name__ == "__main__":
    main()

Discussion

ログインするとコメントできます