結果

問題 No.1765 While Shining
ユーザー sasa8uyauyasasa8uyauya
提出日時 2024-11-03 14:29:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 210 bytes
コンパイル時間 338 ms
コンパイル使用メモリ 82,160 KB
実行使用メモリ 104,476 KB
最終ジャッジ日時 2024-11-03 14:29:16
合計ジャッジ時間 3,890 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))
c=0
l=0
while l<n-1:
  if a[l]==0:
    l+=1
    continue
  r=l
  while r+1<n-1 and a[r+1]!=a[r]:
    r+=1
  for i in range(l,r+1,2):
    c+=r-i+1
  l=r+1
print(c)
0