結果

問題 No.1686 Geschenkt
ユーザー toshiro_yanagi
提出日時 2022-07-02 18:41:04
言語 Ruby
(3.4.1)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 169 bytes
コンパイル時間 140 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,160 KB
最終ジャッジ日時 2024-11-27 14:28:23
合計ジャッジ時間 1,788 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

n = gets.to_i
a = gets.split(" ").map(&:to_i).sort!

ans = 0
a.each.with_index{|v, i|
	if i == 0
		ans += v
	else
		if a[i-1] + 1 != v
			ans += v
		end
	end
}
puts ans
0