結果

問題 No.1765 While Shining
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-11-26 22:54:17
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 203 bytes
コンパイル時間 330 ms
コンパイル使用メモリ 10,632 KB
実行使用メモリ 11,408 KB
最終ジャッジ日時 2023-09-12 05:21:49
合計ジャッジ時間 3,815 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,900 KB
testcase_01 AC 15 ms
7,852 KB
testcase_02 AC 16 ms
7,780 KB
testcase_03 AC 16 ms
7,944 KB
testcase_04 AC 15 ms
7,944 KB
testcase_05 AC 16 ms
7,776 KB
testcase_06 AC 16 ms
7,888 KB
testcase_07 AC 15 ms
7,856 KB
testcase_08 AC 17 ms
7,856 KB
testcase_09 AC 91 ms
10,336 KB
testcase_10 AC 126 ms
11,332 KB
testcase_11 AC 115 ms
10,872 KB
testcase_12 AC 120 ms
11,044 KB
testcase_13 AC 115 ms
10,780 KB
testcase_14 AC 134 ms
11,204 KB
testcase_15 AC 137 ms
11,312 KB
testcase_16 AC 138 ms
11,348 KB
testcase_17 AC 139 ms
11,396 KB
testcase_18 AC 136 ms
11,380 KB
testcase_19 AC 134 ms
11,328 KB
testcase_20 AC 134 ms
11,332 KB
testcase_21 AC 136 ms
11,336 KB
testcase_22 AC 133 ms
11,332 KB
testcase_23 AC 142 ms
11,408 KB
testcase_24 AC 129 ms
11,396 KB
権限があれば一括ダウンロードができます

ソースコード

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