結果

問題 No.889 素数!
ユーザー MiyamonYMiyamonY
提出日時 2019-09-29 00:42:01
言語 Scheme
(Gauche-0.9.14)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 1,113 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 6,944 KB
実行使用メモリ 29,568 KB
最終ジャッジ日時 2024-04-14 07:08:47
合計ジャッジ時間 9,865 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
29,508 KB
testcase_01 AC 127 ms
29,312 KB
testcase_02 AC 123 ms
29,312 KB
testcase_03 AC 125 ms
29,428 KB
testcase_04 AC 124 ms
29,276 KB
testcase_05 AC 125 ms
29,184 KB
testcase_06 AC 123 ms
29,312 KB
testcase_07 AC 122 ms
29,416 KB
testcase_08 AC 123 ms
29,312 KB
testcase_09 AC 122 ms
29,284 KB
testcase_10 AC 121 ms
29,312 KB
testcase_11 AC 122 ms
29,184 KB
testcase_12 AC 120 ms
29,312 KB
testcase_13 AC 123 ms
29,568 KB
testcase_14 AC 123 ms
29,184 KB
testcase_15 AC 122 ms
29,312 KB
testcase_16 AC 125 ms
29,312 KB
testcase_17 AC 123 ms
29,440 KB
testcase_18 AC 124 ms
29,312 KB
testcase_19 AC 121 ms
29,312 KB
testcase_20 AC 123 ms
29,440 KB
testcase_21 AC 126 ms
29,312 KB
testcase_22 AC 123 ms
29,280 KB
testcase_23 AC 123 ms
29,256 KB
testcase_24 AC 122 ms
29,312 KB
testcase_25 AC 123 ms
29,312 KB
testcase_26 AC 121 ms
29,312 KB
testcase_27 AC 124 ms
29,212 KB
testcase_28 AC 123 ms
29,184 KB
testcase_29 AC 122 ms
29,312 KB
testcase_30 AC 120 ms
29,312 KB
testcase_31 AC 121 ms
29,448 KB
testcase_32 AC 122 ms
29,312 KB
testcase_33 AC 123 ms
29,312 KB
testcase_34 AC 123 ms
29,184 KB
testcase_35 AC 124 ms
29,184 KB
testcase_36 AC 124 ms
29,312 KB
testcase_37 AC 122 ms
29,184 KB
testcase_38 AC 123 ms
29,184 KB
testcase_39 AC 123 ms
29,184 KB
testcase_40 AC 124 ms
29,312 KB
testcase_41 AC 123 ms
29,276 KB
testcase_42 AC 124 ms
29,184 KB
testcase_43 AC 126 ms
29,312 KB
testcase_44 AC 123 ms
29,348 KB
testcase_45 AC 124 ms
29,184 KB
testcase_46 AC 126 ms
29,440 KB
testcase_47 AC 124 ms
29,312 KB
testcase_48 AC 124 ms
29,312 KB
testcase_49 AC 123 ms
29,184 KB
testcase_50 AC 123 ms
29,440 KB
testcase_51 AC 122 ms
29,440 KB
testcase_52 AC 124 ms
29,184 KB
testcase_53 AC 121 ms
29,312 KB
testcase_54 AC 122 ms
29,184 KB
testcase_55 AC 122 ms
29,492 KB
testcase_56 AC 124 ms
29,312 KB
testcase_57 AC 122 ms
29,440 KB
testcase_58 AC 123 ms
29,312 KB
testcase_59 AC 125 ms
29,440 KB
testcase_60 AC 123 ms
29,312 KB
testcase_61 AC 122 ms
29,396 KB
testcase_62 AC 124 ms
29,184 KB
testcase_63 AC 123 ms
29,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

;;; File:  main.scm
;; Author: ymiyamoto
;;
;; Created on Sun Sep 29 00:31:43 2019
;;
(define-syntax read-number
  (syntax-rules ()
    ((_ nums)
     (define-values nums
       (apply values (map string->number (string-split (read-line) #\space)))))))

(define-syntax read-numbers
  (syntax-rules ()
    ((_ as)
     (define as (map string->number (string-split (read-line) #\space))))
    ((_ as n)
     (define as (map (lambda (_) (map string->number (string-split (read-line) #\space))) (iota n))))))

(define-syntax prlist
  (syntax-rules ()
    ((_ lis)
     (print (string-join (map number->string lis) " ")))))

(define-syntax 1+ (syntax-rules () ((_ x) (+ x 1))))

(define-syntax 1- (syntax-rules () ((_ x) (- x 1))))

(define MOD 1000000007)

(use math.prime)

(define (solve)
  (read-number (n))

  (print (cond ((small-prime? n) "Sosu!")
	       ((find (lambda (m) (= m n)) (map (lambda (n) (* n n)) (iota 8 2))) "Heihosu!")
	       ((find (lambda (m) (= m n)) (map (lambda (n) (* n n n)) (iota 8 2))) "Ripposu!")
	       ((find (lambda (m) (= m n)) '(6 28)) "Kanzensu!")
	       (else n))))

(solve)
0