結果

問題 No.1765 While Shining
ユーザー tomeruntomerun
提出日時 2021-11-26 22:35:15
言語 Crystal
(1.11.2)
結果
RE  
実行時間 -
コード長 187 bytes
コンパイル時間 19,353 ms
コンパイル使用メモリ 253,856 KB
実行使用メモリ 15,196 KB
最終ジャッジ日時 2023-09-12 05:13:18
合計ジャッジ時間 19,519 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,444 KB
testcase_01 AC 2 ms
4,488 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,400 KB
testcase_04 AC 2 ms
4,536 KB
testcase_05 AC 3 ms
4,576 KB
testcase_06 AC 3 ms
4,464 KB
testcase_07 AC 2 ms
4,560 KB
testcase_08 AC 2 ms
4,456 KB
testcase_09 AC 14 ms
10,352 KB
testcase_10 AC 18 ms
11,208 KB
testcase_11 AC 15 ms
11,136 KB
testcase_12 AC 17 ms
11,156 KB
testcase_13 AC 16 ms
11,212 KB
testcase_14 AC 22 ms
14,696 KB
testcase_15 AC 21 ms
14,836 KB
testcase_16 AC 22 ms
14,856 KB
testcase_17 AC 21 ms
14,840 KB
testcase_18 AC 22 ms
14,808 KB
testcase_19 AC 22 ms
14,708 KB
testcase_20 AC 22 ms
14,696 KB
testcase_21 AC 22 ms
14,696 KB
testcase_22 AC 22 ms
14,796 KB
testcase_23 AC 22 ms
14,772 KB
testcase_24 RE -
権限があれば一括ダウンロードができます

ソースコード

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