結果
| 問題 |
No.888 約数の総和
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-09-20 22:04:19 |
| 言語 | Scheme (Gauche-0.9.15) |
| 結果 |
AC
|
| 実行時間 | 97 ms / 2,000 ms |
| コード長 | 453 bytes |
| コンパイル時間 | 146 ms |
| コンパイル使用メモリ | 6,684 KB |
| 実行使用メモリ | 16,128 KB |
| 最終ジャッジ日時 | 2024-09-14 17:37:31 |
| 合計ジャッジ時間 | 2,840 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
(define (divisor n)
(let loop ([i 1]
[l '()])
(cond [(> (* i i) n) l]
[(zero? (remainder n i)) (if (= i (quotient n i))
(loop (+ i 1) (cons i l))
(loop (+ i 1) (cons i (cons (quotient n i) l))))]
[else (loop (+ i 1) l)])))
(define (solve n)
(apply + (divisor n)))
(define (main args)
(let ([n (read)])
(print (solve n)))
0)