結果

問題 No.1765 While Shining
ユーザー tomerun
提出日時 2021-11-26 22:35:15
言語 Crystal
(1.14.0)
結果
RE  
実行時間 -
コード長 187 bytes
コンパイル時間 12,692 ms
コンパイル使用メモリ 296,344 KB
実行使用メモリ 12,972 KB
最終ジャッジ日時 2024-06-29 18:14:00
合計ジャッジ時間 13,563 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

n = read_line.to_i
a = read_line.split.map(&.to_i).reverse
s = 1
ans = 0
1.upto(n - 1) do |i|
  if a[i] == a[i - 1]
    s = i
  end
  if a[i] == 1
    ans += i - s + 1
  end
end
puts ans
0