結果

問題 No.1765 While Shining
ユーザー pluto77pluto77
提出日時 2022-02-07 10:45:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 186 bytes
コンパイル時間 84 ms
コンパイル使用メモリ 10,728 KB
実行使用メモリ 11,444 KB
最終ジャッジ日時 2023-09-02 18:41:27
合計ジャッジ時間 3,971 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,744 KB
testcase_01 AC 15 ms
7,824 KB
testcase_02 AC 15 ms
7,840 KB
testcase_03 AC 15 ms
7,820 KB
testcase_04 AC 16 ms
7,836 KB
testcase_05 AC 16 ms
7,828 KB
testcase_06 AC 15 ms
7,900 KB
testcase_07 AC 15 ms
7,824 KB
testcase_08 AC 16 ms
7,784 KB
testcase_09 AC 88 ms
10,384 KB
testcase_10 AC 118 ms
11,396 KB
testcase_11 AC 105 ms
10,752 KB
testcase_12 AC 112 ms
11,032 KB
testcase_13 AC 105 ms
11,332 KB
testcase_14 AC 127 ms
11,288 KB
testcase_15 AC 128 ms
11,400 KB
testcase_16 AC 129 ms
11,440 KB
testcase_17 AC 129 ms
11,292 KB
testcase_18 AC 126 ms
11,264 KB
testcase_19 AC 131 ms
11,332 KB
testcase_20 AC 129 ms
11,376 KB
testcase_21 AC 126 ms
11,444 KB
testcase_22 AC 127 ms
11,252 KB
testcase_23 AC 130 ms
11,268 KB
testcase_24 AC 124 ms
11,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki1765
n=int(input())
a=list(map(int,input().split()))
cnt=0
x=0
if a[0]==1:
 x=1
for i in range(1,n):
 if a[i]!=a[i-1]:
  cnt+=x
 else:
  cnt+=x
  x=0
 if a[i]==1:
  x+=1
print(cnt)
0