結果

問題 No.51 やる気の問題
ユーザー MiyamonYMiyamonY
提出日時 2019-09-07 02:28:30
言語 Scheme
(Gauche-0.9.14)
結果
AC  
実行時間 60 ms / 5,000 ms
コード長 358 bytes
コンパイル時間 68 ms
コンパイル使用メモリ 5,336 KB
実行使用メモリ 15,756 KB
最終ジャッジ日時 2023-09-07 07:31:18
合計ジャッジ時間 2,331 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
12,828 KB
testcase_01 AC 25 ms
12,780 KB
testcase_02 AC 17 ms
11,784 KB
testcase_03 AC 26 ms
12,748 KB
testcase_04 AC 25 ms
12,592 KB
testcase_05 AC 57 ms
15,756 KB
testcase_06 AC 38 ms
13,492 KB
testcase_07 AC 39 ms
13,360 KB
testcase_08 AC 32 ms
13,016 KB
testcase_09 AC 59 ms
13,952 KB
testcase_10 AC 34 ms
13,084 KB
testcase_11 AC 32 ms
13,128 KB
testcase_12 AC 41 ms
13,568 KB
testcase_13 AC 41 ms
13,712 KB
testcase_14 AC 38 ms
13,332 KB
testcase_15 AC 54 ms
13,892 KB
testcase_16 AC 32 ms
12,988 KB
testcase_17 AC 27 ms
12,688 KB
testcase_18 AC 54 ms
13,796 KB
testcase_19 AC 55 ms
13,884 KB
testcase_20 AC 39 ms
13,408 KB
testcase_21 AC 27 ms
12,732 KB
testcase_22 AC 60 ms
13,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

(define (read-number)
  (string->number (read-line)))

(define (generate n)
  (define m n)
  (lambda () (let1 k m
	      (set! m (- m 1))
	      k)))

(let* ((w (read-number))
       (d (read-number)))
  (define gen (generate d))

  (print (let loop ((rem w))
	   (let1 n (gen)
		 (cond ((= n 1) rem)
		       (else
			(loop (- rem (div rem (* n n))))))))))
0