编程序,让计算机来猜测用户“暗记”的某张扑克牌:计算机从一副扑克牌(54张)中任意抽出27张,摆放在不同的三行上(每行9张),用户“暗记”某张纸牌,而后告诉计算机所“暗记”的那张纸牌处于哪一行中;之后计算机再两次将纸牌重新摆放,并让用户再回答两次相同的提问(那张纸牌在重新摆放后又处在哪一行上);此时计算机会将用户所“暗记”的那张纸牌给挑出来。 例如,程序执行后的屏幕显示结果可设计为(其中的前缀a、b、c、d代表四种不同的花色): ------------------------------------------------------------- Line 1: c-9 d-3 a-7 d-9 a-9 c-3 b-8 a-A d-7 Line 2: b-10 a-Q d-6 b-4 a-3 b-9 b-K c-A d-8 Line 3: KING2 d-A b-A a-4 a-2 b-7 d-5 c-7 a-8 ------------------------------------------------------------- Remember a card, and tell me what line it reside in(1/2/3): 3 ------------------------------------------------------------- Line 1: c-9 d-3 a-7 b-10 a-Q d-6 KING2 d-A b-A Line 2: d-9 a-9 c-3 b-4 a-3 b-9 a-4 a-2 b-7 Line 3: b-8 a-A d-7 b-K c-A d-8 d-5 c-7 a-8 ------------------------------------------------------------- What line the card you remembered reside in now (1/2/3) : 1 ------------------------------------------------------------- Line 1: c-9 b-10 KING2 d-9 b-4 a-4 b-8 b-K d-5 Line 2: d-3 a-Q d-A a-9 a-3 a-2 a-A c-A c-7 Line 3: a-7 d-6 b-A c-3 b-9 b-7 d-7 d-8 a-8 ------------------------------------------------------------- What line the card you remembered reside in now (1/2/3) : 1 ------------------------------------------------------------- Your remembered card is : KING2
1