⌨️

[AtCoder]ABC-051|B - Sum of Three Integers

2022/12/20に公開

設問ページ

提出結果

def getIntMap():
    return map(int, input().split())


def main():
    k, s = getIntMap()

    c = 0
    for x in range(k + 1):
        for y in range(k + 1):
            z = s - (x + y)
            if z >= 0 and z <= k:
                c += 1
    print(c)


if __name__ == "__main__":
    main()

Discussion