| 이전 주제 보기 :: 다음 주제 보기 |
| 글쓴이 |
메시지 |
김진영_
가입: 2009년 12월 9일 올린 글: 337
|
올려짐: 2010년10월18일 23:38 주제: *숙제 4, 문제 2* 테스트 케이스를 제공해 드립니다. (몇 가지 경우 추가) |
|
|
이번 숙제의 목적 중 하나는 올바른 프로그램인지 확신하기가 쉽지 않은 문제를 겪어 보는 것입니다.
간단한 테스트 케이스를 일부 제공해 드립니다. 물론 아래의 경우에 모두 맞는 답을 낸다고 해서 여러분의 프로그램이 올바르다는 보장은 없습니다. 하지만 어느 정도나마 숙제에 도움이 되셨으면 합니다. 수강생 여러분들의 추가적인 테스트 케이스 공유도 환영합니다.
| 코드: | (shoppingList (list (cons 'A (mustBeTheSame 'B))
(cons 'B (mustBeTheSame 'A))
(cons 'C (mustBeTheSame 'B))))
; ((A) (B) (C))
(shoppingList (list (cons 'A (mustHaveExceptFor (mustBeTheSame 'B) (list 0)))
(cons 'B (mustHaveExceptFor (mustBeTheSame 'A) (list 1)))
(cons 'C (mustHaveExceptFor (mustBeTheSame 'B) (list 2)))))
; ((A) (B) (C))
(shoppingList (list (cons 'A (mustAnd (mustBeTheSame 'B) (mustBeTheSame 'C)))
(cons 'B (mustAnd (mustBeTheSame 'A) (mustBeTheSame 'C)))
(cons 'C (mustAnd (mustBeTheSame 'A) (mustBeTheSame 'B)))))
; ((A) (B) (C))
(shoppingList (list (cons 'A (mustItems (list 100)))
(cons 'B (mustItems (list 200)))
(cons 'C (mustItems (list 300)))))
; ((A 100) (B 200) (C 300))
(shoppingList (list (cons 'A (mustAnd (mustItems (list 1 2))
(mustHaveCommon (mustBeTheSame 'B) (mustBeTheSame 'C))))
(cons 'B (mustHaveCommon (mustBeTheSame 'C) (mustItems (list 3 2))))
(cons 'C (mustAnd (mustItems (list 1))
(mustHaveExceptFor (mustBeTheSame 'A) (list 3))))))
;((A 1 2) (B 2) (C 1 2)))
(shoppingList (list (cons 'Haley (mustBeTheSame 'Luke))
(cons 'Alex (mustItems (list 2 0 1)))
(cons 'Luke (mustBeTheSame 'Alex))))
;((Haley 0 1 2) (Alex 0 1 2) (Luke 0 1 2))
(shoppingList (list (cons 'A (mustAnd
(mustHaveExceptFor (mustHaveCommon (mustBeTheSame 'B)
(mustBeTheSame 'C))
(list 4))
(mustItems (list 1 2 3))))
(cons 'B (mustAnd
(mustHaveExceptFor (mustHaveCommon (mustBeTheSame 'C)
(mustBeTheSame 'D))
(list 5))
(mustItems (list 2 3 4))))
(cons 'C (mustAnd
(mustHaveExceptFor (mustHaveCommon (mustBeTheSame 'A)
(mustBeTheSame 'E))
(list 1))
(mustItems (list 3 4 5))))
(cons 'D (mustAnd
(mustHaveExceptFor (mustHaveCommon (mustBeTheSame 'E)
(mustBeTheSame 'B))
(list 3))
(mustItems (list 1 4 5))))
(cons 'E (mustAnd
(mustHaveExceptFor (mustHaveCommon (mustBeTheSame 'B)
(mustBeTheSame 'A))
(list 2 4))
(mustItems (list 1 3 5))))))
;((A 1 2 3) (B 2 3 4) (C 3 4 5) (D 1 4 5) (E 1 3 5))
(shoppingList (list (cons 'X (mustAnd (mustItems (list 0 4 1))
(mustHaveExceptFor (mustBeTheSame 'Z) (list 3 0 2))))
(cons 'Y (mustHaveExceptFor (mustItems (list 0 4 2 3)) (list 4 2 0)))
(cons 'Z (mustItems (list 0 2)))))
;((X 0 1 4) (Y 3) (Z 0 2))
(shoppingList (list
(cons 'A (mustBeTheSame 'G))
(cons 'B (mustBeTheSame 'D))
(cons 'C (mustItems (list 0 3 4 7 1 2)))
(cons 'D (mustHaveExceptFor (mustBeTheSame 'C) (list 3 6 2 7 4 0 5)))
(cons 'E (mustHaveCommon (mustBeTheSame 'A)
(mustAnd (mustHaveExceptFor (mustItems (list 7 4 2 0 5)) (list 3 2 0 5 7 4))
(mustBeTheSame 'A))))
(cons 'F (mustBeTheSame 'B))
(cons 'G (mustHaveExceptFor (mustAnd (mustAnd (mustBeTheSame 'B)
(mustAnd (mustAnd (mustBeTheSame 'E) (mustBeTheSame 'E))
(mustBeTheSame 'B)))
(mustBeTheSame 'H))
(list 1 7 3 4 0 2)))
(cons 'H (mustBeTheSame 'G))))
;((A) (B 1) (C 0 1 2 3 4 7) (D 1) (E) (F 1) (G) (H)) |
김진영_ 가 2010년10월19일 20:47에 수정함, 총 3 번 수정됨 |
|
| 위로 |
|
 |
심규민
가입: 2010년 10월 2일 올린 글: 21
|
올려짐: 2010년10월19일 12:43 주제: mustHaveExceptFor의 input type |
|
|
mustHaveExceptFor: cond * gift_list -> cond
두 번째 인자가 gift_list이어야 하는데 (mustItems gift_list) (즉, cond)가 들어가 있는 테스트 케이스가 있습니다.
확인 부탁드립니다. |
|
| 위로 |
|
 |
김진영_
가입: 2009년 12월 9일 올린 글: 337
|
올려짐: 2010년10월19일 12:49 주제: |
|
|
그렇네요.
손으로 데이터를 만들다가 실수한 부분이 있었습니다. 수정했습니다. |
|
| 위로 |
|
 |
김진영_
가입: 2009년 12월 9일 올린 글: 337
|
올려짐: 2010년10월19일 20:23 주제: |
|
|
학생들의 요청이 있어 몇 가지 extreme한 테스트 케이스를 추가로 제공해 드립니다. 2008학년도에 수강생 이충민씨(07)가 게시판에 올리셨던 테스트 케이스 중 어려워 보이는 것을 몇 가지 고른 것입니다.
채점 데이터의 거의 대부분은 처음에 올려 드렸던 정도의 크기로 구성됩니다. 숙제의 목표인 "항상 올바른 답을 내는 프로그램"을 작성하는 데 집중하시길
| 코드: | (define v1
(list
(cons 'A (mustBeTheSame 'G))
(cons 'B (mustAnd (mustBeTheSame 'D) (mustItems '(0 2 4 7 3 6))))
(cons 'C (mustAnd (mustHaveCommon (mustBeTheSame 'A) (mustAnd (mustHaveExceptFor (mustHaveExceptFor (mustAnd (mustHaveCommon (mustAnd (mustAnd (mustItems '(3 4 8 5 2 7 6)) (mustHaveCommon (mustBeTheSame 'G) (mustItems '(0 1 3 6 8 7)))) (mustAnd (mustAnd (mustHaveCommon (mustHaveExceptFor (mustHaveCommon (mustAnd (mustBeTheSame 'E) (mustBeTheSame 'D)) (mustAnd (mustItems '(1 7 2 0 5 6 8)) (mustItems '(2 6 3 5 1)))) '(0 1 6 7 2 5 3)) (mustAnd (mustHaveCommon (mustBeTheSame 'D) (mustHaveExceptFor (mustItems '(8 1 5 0 7 4)) '(6 4 5 3 0 8))) (mustAnd (mustItems '(7 0 1 8 4)) (mustItems '(1 4 8 3 2 5 0))))) (mustItems '(0 8 7 2))) (mustBeTheSame 'H))) (mustItems '(0 1 5 6 3 2))) (mustBeTheSame 'A)) '(4 8 7 1 0 3)) '(8 7 6 1)) (mustBeTheSame 'F))) (mustAnd (mustBeTheSame 'A) (mustItems '(7 3 5 8 4 0)))))
(cons 'D (mustItems '(2 6 0 5 3 1)))
(cons 'E (mustAnd (mustItems '(2 1 7 5 8)) (mustHaveExceptFor (mustHaveExceptFor (mustAnd (mustAnd (mustAnd (mustAnd (mustHaveCommon (mustAnd (mustItems '(8 1 3 6 2 5 0)) (mustBeTheSame 'C)) (mustAnd (mustBeTheSame 'A) (mustBeTheSame 'D))) (mustHaveExceptFor (mustBeTheSame 'C) '(6 2 4 8 0 1 3))) (mustBeTheSame 'B)) (mustItems '(3 0 8 6 7 4 1))) (mustItems '(3 0 6 4 7 1))) '(2 7 6 4 5)) '(5 8 6 3 7 1))))
(cons 'F (mustBeTheSame 'H))
(cons 'G (mustItems '(6 1 8 5 0 3)))
(cons 'H (mustBeTheSame 'G))))
(define v2
(list
(cons 'A (mustHaveExceptFor (mustBeTheSame 'O) '(5 1 3 4 6)))
(cons 'B (mustHaveCommon (mustAnd (mustItems '(1 6 2)) (mustHaveCommon (mustItems '(2 5 1 6 3)) (mustAnd (mustHaveCommon (mustAnd (mustHaveExceptFor (mustBeTheSame 'L) '(4 2 1)) (mustItems '(1 4 5 3))) (mustHaveExceptFor (mustItems '(5 6 2 1 4)) '(5 6 3))) (mustBeTheSame 'G)))) (mustItems '(5 0 6 3))))
(cons 'C (mustItems '(3 1 2 0)))
(cons 'D (mustItems '(4 6 0 5)))
(cons 'E (mustAnd (mustAnd (mustBeTheSame 'C) (mustBeTheSame 'B)) (mustAnd (mustItems '(4 3 0 2)) (mustBeTheSame 'I))))
(cons 'F (mustBeTheSame 'D))
(cons 'G (mustHaveCommon (mustAnd (mustHaveCommon (mustBeTheSame 'O) (mustAnd (mustAnd (mustItems '(0 5 3 2 4 6)) (mustItems '(3 4 2 6 0))) (mustBeTheSame 'O))) (mustItems '(6 4 0 1 2))) (mustAnd (mustBeTheSame 'I) (mustBeTheSame 'B))))
(cons 'H (mustHaveExceptFor (mustBeTheSame 'C) '(5 4 3 0)))
(cons 'I (mustItems '(4 1 0 2 3)))
(cons 'J (mustBeTheSame 'H))
(cons 'K (mustAnd (mustHaveCommon (mustBeTheSame 'F) (mustBeTheSame 'H)) (mustHaveCommon (mustBeTheSame 'J) (mustBeTheSame 'J))))
(cons 'L (mustAnd (mustBeTheSame 'D) (mustHaveCommon (mustBeTheSame 'M) (mustAnd (mustAnd (mustAnd (mustAnd (mustItems '(4 6 2 1)) (mustBeTheSame 'G)) (mustAnd (mustAnd (mustItems '(6 4 1 0)) (mustHaveCommon (mustItems '(1 6 3 2 4 5)) (mustBeTheSame 'J))) (mustItems '(4 5 2 6)))) (mustAnd (mustAnd (mustHaveExceptFor (mustItems '(1 6 4 5)) '(0 3 2 5)) (mustBeTheSame 'A)) (mustBeTheSame 'N))) (mustAnd (mustItems '(4 3 1 5 2)) (mustHaveExceptFor (mustHaveExceptFor (mustHaveExceptFor (mustHaveExceptFor (mustAnd (mustAnd (mustHaveExceptFor (mustBeTheSame 'L) '(1 3 0 5 4)) (mustItems '(4 6 3 2))) (mustBeTheSame 'G)) '(4 0 3 1 6)) '(6 1 4 5 2)) '(0 1 2 6 4)) '(4 2 0 5)))))))
(cons 'M (mustBeTheSame 'K))
(cons 'N (mustBeTheSame 'N))
(cons 'O (mustItems '(1 3 2 6 5)))
(cons 'P (mustBeTheSame 'C))))
(define v3
(list
(cons 'A (mustAnd (mustAnd (mustBeTheSame 'H) (mustBeTheSame 'P)) (mustItems '(2 4 3 6))))
(cons 'B (mustHaveCommon (mustBeTheSame 'B) (mustAnd (mustItems '(2 1 5 0 4)) (mustItems '(6 4 5 2 1)))))
(cons 'C (mustItems '(1 4 5 6 2 0)))
(cons 'D (mustBeTheSame 'J))
(cons 'E (mustItems '(2 6 3 5)))
(cons 'F (mustItems '(4 6 3 2 1 5)))
(cons 'G (mustAnd (mustItems '(1 4 6 0)) (mustItems '(4 5 2 1 3 6))))
(cons 'H (mustAnd (mustHaveCommon (mustHaveCommon (mustAnd (mustAnd (mustBeTheSame 'L) (mustAnd (mustAnd (mustBeTheSame 'K) (mustBeTheSame 'K)) (mustItems '(4 5 3 0)))) (mustHaveCommon (mustItems '(5 2 3 1)) (mustItems '(4 3 2 1)))) (mustAnd (mustAnd (mustHaveCommon (mustHaveCommon (mustItems '(4 3 0 6 1)) (mustHaveCommon (mustItems '(3 4 1 0 6)) (mustItems '(4 3 5 2 0 1)))) (mustBeTheSame 'E)) (mustBeTheSame 'D)) (mustItems '(5 1 2 3)))) (mustAnd (mustAnd (mustAnd (mustHaveCommon (mustAnd (mustItems '(2 0 3 4)) (mustItems '(6 2 5 1))) (mustBeTheSame 'J)) (mustAnd (mustHaveCommon (mustBeTheSame 'K) (mustBeTheSame 'A)) (mustHaveExceptFor (mustItems '(3 6 1 0)) '(5 1 3 0 2)))) (mustAnd (mustHaveCommon (mustBeTheSame 'F) (mustHaveExceptFor (mustHaveExceptFor (mustBeTheSame 'L) '(6 4 2 0 1)) '(4 3 6 0))) (mustAnd (mustHaveCommon (mustBeTheSame 'I) (mustAnd (mustItems '(2 4 6 1)) (mustHaveExceptFor (mustHaveExceptFor (mustAnd (mustHaveExceptFor (mustItems '(4 2 0 5 1)) '(3 5 4 1 0)) (mustAnd (mustHaveCommon (mustAnd (mustBeTheSame 'O) (mustHaveExceptFor (mustAnd (mustHaveExceptFor (mustHaveExceptFor (mustAnd (mustHaveExceptFor (mustAnd (mustItems '(6 3 5 2)) (mustBeTheSame 'P)) '(5 3 4 1 6)) (mustAnd (mustBeTheSame 'B) (mustHaveExceptFor (mustBeTheSame 'M) '(1 3 2 4 5)))) '(1 0 5 6 2)) '(6 2 3 1 4 5)) (mustItems '(6 2 4 3 1))) '(4 2 0 1 6))) (mustItems '(0 5 2 4))) (mustBeTheSame 'B))) '(2 4 5 6)) '(3 2 6 5)))) (mustItems '(2 1 0 4 6))))) (mustItems '(2 0 4 3)))) (mustAnd (mustItems '(0 6 5 1)) (mustItems '(2 5 4 3 0)))))
(cons 'I (mustAnd (mustAnd (mustAnd (mustBeTheSame 'F) (mustItems '(3 5 0 6 4))) (mustHaveExceptFor (mustHaveCommon (mustBeTheSame 'O) (mustAnd (mustItems '(2 3 4 6 1)) (mustItems '(3 5 0 6)))) '(2 5 6 0 3 4))) (mustHaveExceptFor (mustItems '(4 3 1 2)) '(2 6 4 3 0))))
(cons 'J (mustBeTheSame 'N))
(cons 'K (mustHaveCommon (mustAnd (mustItems '(5 0 3 1)) (mustAnd (mustItems '(3 1 0)) (mustHaveExceptFor (mustItems '(1 4 3 2 6)) '(3 1 0 4)))) (mustAnd (mustBeTheSame 'B) (mustAnd (mustAnd (mustAnd (mustItems '(5 0 2 6)) (mustItems '(3 1 0 4))) (mustBeTheSame 'E)) (mustAnd (mustItems '(1 6 2 0 5)) (mustItems '(4 5 0 2 6)))))))
(cons 'L (mustAnd (mustBeTheSame 'G) (mustHaveCommon (mustHaveCommon (mustItems '(1 2 5 3)) (mustBeTheSame 'G)) (mustAnd (mustBeTheSame 'A) (mustAnd (mustHaveCommon (mustAnd (mustAnd (mustBeTheSame 'A) (mustAnd (mustBeTheSame 'M) (mustItems '(4 0 1 5 6)))) (mustItems '(5 3 0 6 4))) (mustHaveExceptFor (mustHaveCommon (mustItems '(1 2 6 0 3 5)) (mustHaveExceptFor (mustItems '(3 4 2 1 6)) '(4 6 0 2 1))) '(5 2 1 4 6))) (mustBeTheSame 'L))))))
(cons 'M (mustItems '(3 6 2 0)))
(cons 'N (mustBeTheSame 'H))
(cons 'O (mustItems '(0 5 1 4 6)))
(cons 'P (mustAnd (mustItems '(2 1 4)) (mustHaveExceptFor (mustBeTheSame 'O) '(3 1 2 0))))))
(shoppingList v1)
;((A 6 1 8 5 0 3) (B 5 1 0 2 4 7 3 6) (C 6 1 7 3 5 8 4 0) (D 2 6 0 5 3 1) (E 2 1 7 5 8 0) (F 6 1 8 5 0 3) (G 6 1 8 5 0 3) (H 6 1 8 5 0 3))
(shoppingList v2)
;((A 2) (B 6 3) (C 3 1 2 0) (D 4 6 0 5) (E 3 1 2 0 6 4) (F 4 6 0 5) (G 1 3 2 6 4 0) (H 1 2) (I 4 1 0 2 3) (J 1 2) (K 1 2) (L 4 6 0 5 1 2) (M 1 2) (N) (O 1 3 2 6 5) (P 3 1 2 0))
(shoppingList v3)
;((A 1 5 2 3 0 6 4) (B) (C 1 4 5 6 2 0) (D 3 2 1 0 6 5 4) (E 2 6 3 5) (F 4 6 3 2 1 5) (G 1 4 6 0 5 2 3) (H 1 5 2 3 0 6 4) (I 4 6 3 2 1 5 0) (J 3 1 2 0 6 5 4) (K 5 0 3 1 2 6) (L 1 4 6 0 5 2 3) (M 3 6 2 0) (N 1 5 2 3 0 6 4) (O 0 5 1 4 6) (P 2 1 4 5 6)) |
|
|
| 위로 |
|
 |
|