結果

問題 No.756 チャンパーノウン定数 (1)
コンテスト
ユーザー ciel
提出日時 2018-12-06 12:13:02
言語 Scheme
(Gauche-0.9.15)
コンパイル:
true
実行:
gosh _filename_
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 500 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 152 ms
コンパイル使用メモリ 7,968 KB
実行使用メモリ 16,256 KB
最終ジャッジ日時 2026-04-04 09:34:19
合計ジャッジ時間 1,391 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#!/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