結果
問題 |
No.2795 Perfect Number
|
ユーザー |
|
提出日時 | 2024-07-21 01:19:48 |
言語 | Common Lisp (sbcl 2.5.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 344 bytes |
コンパイル時間 | 162 ms |
コンパイル使用メモリ | 27,520 KB |
実行使用メモリ | 27,392 KB |
最終ジャッジ日時 | 2024-07-21 01:19:52 |
合計ジャッジ時間 | 3,793 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 1 WA * 1 TLE * 1 -- * 32 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 21 JUL 2024 01:19:48 AM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.007
ソースコード
(defun is-perfect-number (n) (let ((sum 1)) (loop for i from 2 to (isqrt n) do (when (zerop (mod n i)) (incf sum i) (unless (= i (/ n i)) (incf sum (/ n i))))) (= sum n))) (defun main () (let ((n (read))) (if (is-perfect-number n) (format t "Yes~%") (format t "No~%")))) (main)