0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

paizaラーニング 「終了判定 Python3編」

0
Last updated at Posted at 2022-11-21

https://paiza.jp/works/mondai/conditions_branch/conditions_branch__complex_step4
私の回答

n=int(input())
array=list(map(int,input().split()))
sum=0
for i in range(n):
    if array[i]%2!=0:
        break
    sum=sum+array[i]
print(sum)

模範回答

n = int(input())
a = [int(x) for x in input().split()]

ans = 0
for ele in a:
    if ele % 2 == 1:
        break

    ans += ele

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?