結果
| 問題 | No.638 Sum of "not power of 2" |
| コンテスト | |
| ユーザー |
CreativeGP1
|
| 提出日時 | 2018-02-21 20:56:29 |
| 言語 | Scheme (Gauche-0.9.15) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 662 bytes |
| コンパイル時間 | 117 ms |
| コンパイル使用メモリ | 6,816 KB |
| 実行使用メモリ | 512,764 KB |
| 最終ジャッジ日時 | 2024-09-19 10:38:52 |
| 合計ジャッジ時間 | 2,934 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 2 |
| other | AC * 7 TLE * 1 MLE * 1 -- * 3 |
ソースコード
(define (slist->string slst)
(string-join (map symbol->string slst) " "))
(define N (read))
(define s2
(lambda (n) (if (<= n 1) (if (= n 1) #t #f) (s2 (/ n 2)))))
(define (list-of-sum n a)
(if (= a 0)
'()
(cons (list a (- n a)) (list-of-sum n (- a 1)))))
(define (last_element l)
(cond ((null? (cdr l)) (car l))
(else (last_element (cdr l)))))
(let ((ans (filter (lambda (n) (and (not (s2 (list-ref n 0))) (not (s2 (list-ref n 1))))) (list-of-sum N (- N 1)))))
(display (if (= 0 (length ans)) "-1\n" (format "~a ~a\n" (list-ref (last_element ans) 0) (list-ref (last_element ans) 1))
)))
CreativeGP1