⌨️

[AtCoder]ABC-327|B - A^A

2023/11/29に公開

設問ページ

提出結果

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


def main():
    b = getInt()
    a = 0

    while True:
        a += 1
        aa = a ** a
        if aa == b:
            print(a)
            break
        elif aa > b:
            print(-1)
            break


if __name__ == "__main__":
    main()

Discussion