結果

問題 No.1458 Segment Function
ユーザー kotatsugamekotatsugame
提出日時 2021-03-31 21:20:14
言語 Ruby
(3.3.0)
結果
AC  
実行時間 512 ms / 2,000 ms
コード長 200 bytes
コンパイル時間 50 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 13,952 KB
最終ジャッジ日時 2024-04-20 17:36:06
合計ジャッジ時間 10,227 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
12,160 KB
testcase_01 AC 75 ms
12,160 KB
testcase_02 AC 78 ms
12,160 KB
testcase_03 AC 77 ms
12,160 KB
testcase_04 AC 77 ms
12,160 KB
testcase_05 AC 75 ms
12,160 KB
testcase_06 AC 82 ms
12,160 KB
testcase_07 AC 74 ms
12,288 KB
testcase_08 AC 468 ms
13,312 KB
testcase_09 AC 475 ms
13,440 KB
testcase_10 AC 475 ms
13,312 KB
testcase_11 AC 471 ms
13,312 KB
testcase_12 AC 468 ms
13,184 KB
testcase_13 AC 126 ms
13,312 KB
testcase_14 AC 127 ms
13,056 KB
testcase_15 AC 125 ms
13,056 KB
testcase_16 AC 125 ms
13,056 KB
testcase_17 AC 125 ms
13,056 KB
testcase_18 AC 507 ms
13,952 KB
testcase_19 AC 511 ms
13,696 KB
testcase_20 AC 512 ms
13,952 KB
testcase_21 AC 510 ms
13,952 KB
testcase_22 AC 511 ms
13,824 KB
testcase_23 AC 75 ms
12,160 KB
testcase_24 AC 436 ms
13,184 KB
testcase_25 AC 75 ms
12,160 KB
testcase_26 AC 220 ms
13,952 KB
testcase_27 AC 220 ms
13,824 KB
testcase_28 AC 76 ms
12,160 KB
testcase_29 AC 179 ms
13,184 KB
testcase_30 AC 185 ms
13,056 KB
testcase_31 AC 100 ms
13,184 KB
testcase_32 AC 474 ms
13,312 KB
testcase_33 AC 474 ms
13,312 KB
testcase_34 AC 472 ms
13,440 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def f(x)
	if x<0
		1+f(-x)
	else
		ret=0
		x.to_s.bytes{|c|
			ret+=[6,2,5,5,4,5,6,4,7,6][c-48]
		}
		ret
	end
end
x,n=gets.split.map &:to_i
while n>0
	n-=1
	y=f(x)
	if x==y
		break
	end
	x=y
end
p x
0