結果

問題 No.105 arcの六角ボルト
ユーザー ducktailducktail
提出日時 2018-09-06 21:38:44
言語 Scheme
(Gauche-0.9.14)
結果
AC  
実行時間 152 ms / 5,000 ms
コード長 748 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 5,296 KB
実行使用メモリ 17,892 KB
最終ジャッジ日時 2023-08-15 20:18:23
合計ジャッジ時間 1,031 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 152 ms
17,892 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

(use math.const)

(define (main args)
  (let [(n (read))]
    (let loop [(x n)]
      (cond [(zero? x) #t]
            [else
             (print (solve))
             (loop (- x 1))])))
  0)

(define (solve)
  (let [(pl (read-points))
        (xmn (cos (* pi/180 171)))
        (xmx (cos (* pi/180 119)))]
    ($ apply min
       $ filter (^a (>= a 0))
       $ map ang
       $ filter (^p (and (< (car p) xmx) (< xmn (car p)) (> (cadr p) 0))) pl)))

(define (read-points)
  (let loop [(n 6)
             (ls ())]
    (cond [(zero? n) ls]
          [else (loop (- n 1) (cons (list (read) (read)) ls))])))

(define (ang x)
  (let [(eps 0.000001)
        (a (- (* 180/pi (acos (car x))) 120.0))]
    (cond [(> eps (abs a)) 0.0]
          [else a])))
0