|
以前遇到过,也不能保证是否完整sdlkfj5
假设:商店货品价格(R)皆不大於100元(且为整数) (1)R>100;(2)0<R<=100;(3)R<=0
顾客付款在100元内(P) (1) P>100;(2)R<=P<=100;(3)P<R
货币面值50元(N50),10元(N10),5元(N5),1元(N1)四种
(1)N50=1;(2)N50=0
(3)4>=N10>=1;(4)N10=0
(5)N5=1;(6)N5=0
(7)4>=N1>=1;(8)N1=0
以RR1,RR2,RR3表示计算要找50,10,5元货币数时之剩余金额
(1)RR1>=50 ;(2)RR2>=10 ;(3)RR3>=5
由上述之输入/输出条件组合出可能的情形
R > 100 货品价格 = 101
R <= 0 货品价格 = 0 or 货品价格 = -1
0 < R <= 100, P > 100 货品价格 = 100, 付款金额 = 101
0 < R <= 100, P < R 货品价格 = 100, 付款金额 = 99
0 < R <= 100, R <= P <= 100, RR = 50 货品价格 = 50, 付款金额 = 100
0 < R <= 100, R <= P <= 100, RR = 49 货品价格 = 51, 付款金额 = 100
0 < R <= 100, R <= P <= 100, RR = 10 货品价格 = 90, 付款金额 = 100
0 < R <= 100, R <= P <= 100, RR = 9 货品价格 = 91, 付款金额 = 100
0 < R <= 100, R <= P <= 100, RR = 5 货品价格 = 95, 付款金额 = 100
0 < R <= 100, R <= P <= 100, RR = 4 货品价格 = 96, 付款金额 = 100
0 < R <= 100, R <= P <= 100, RR = 1 货品价格 = 99, 付款金额 = 100
0 < R <= 100, R <= P <= 100, RR = 0 货品价格 = 100, 付款金额 = 100 |
|