結果

問題 No.756 チャンパーノウン定数 (1)
ユーザー ciel
提出日時 2018-12-06 12:13:02
言語 Scheme
(Gauche-0.9.15)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 500 bytes
コンパイル時間 215 ms
コンパイル使用メモリ 6,816 KB
実行使用メモリ 16,128 KB
最終ジャッジ日時 2024-09-14 02:25:12
合計ジャッジ時間 2,264 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env gosh

(define (calc2 d num bse)
	(if (zero? d)
		(modulo num bse)
		(calc2 (- d 1) (quotient num bse) bse)
	)
)
(define (calc digits expbase bse x n)
	(if (> x n)
		(calc2 (- (- digits 1) (modulo n digits)) (+ expbase (quotient n digits)) bse)
		(calc (+ digits 1) (* expbase bse) bse (* (* (+ digits 1) (* expbase bse)) (- bse 1)) (- n x))
	)
)

(define (ma)
	(let ((n (read)))
		(if (not (eof-object? n)) (begin
			(write (calc 1 1 10 9 (- n 1)))
			(newline)
			(ma)
		))
	)
)

(ma)
0