LoginSignup
0
0

More than 1 year has passed since last update.

paizaラーニング「加算された数列の最大値 Python3編」

Last updated at Posted at 2022-11-30

私の解答

n = int(input())
a = (int(x) for x in input().split())
s = []
i = 1
for ele in a:
    s.append(ele + i)
    i = i + 1
print(max(s))

解答例

N = int(input())
a = list(map(int, input().split()))

ans = 0
for i in range(N):
    ans = max(ans, a[i] + (i + 1))

print(ans)

解答例と比べて、私の解答は長すぎですね。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0