結果

問題 No.1765 While Shining
ユーザー NatsubiSogan
提出日時 2021-11-26 22:54:17
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 147 ms / 2,000 ms
コード長 203 bytes
コンパイル時間 70 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 14,008 KB
最終ジャッジ日時 2024-06-29 18:21:24
合計ジャッジ時間 3,196 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
cnt = 0
cur = 0
for i in range(n):
	if i > 0 and a[i] != a[i - 1]:
		cnt += cur
	elif i > 0:
		cnt += cur
		cur = 0
	if a[i] == 1: cur += 1
print(cnt)
0