結果

問題 No.432 占い(Easy)
ユーザー horiesiniti
提出日時 2018-03-11 19:22:50
言語 Ruby
(3.4.1)
結果
AC  
実行時間 158 ms / 2,000 ms
コード長 238 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 14,208 KB
最終ジャッジ日時 2024-10-15 00:22:07
合計ジャッジ時間 3,825 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def f(xs)
	res=[]
	e=xs.shift
	while xs.empty? == false
		e2=e+xs[0]
		e2=e2%10+1 if(e2>=10)
		res<<e2
		e=xs.shift
	end
	return res
end
gets.to_i.times{
	xs=gets.chomp.split("").map{|e| e.to_i}
	while xs.size>1
		xs=f(xs)
	end
	p xs[0]
}
0