Problem Description
Bridge is a very complicated card game, and the bidding part is particularly difficult to master. The bidding is made even more difficult because players use different bidding conventions (meanings assigned to bids). In this problem, you are asked to write a program that suggests the first bid that should be made. The bidding conventions described below are simplified from those used by a certain person who shall remain nameless.

A bridge hand consists of 13 cards. Each card has a suit (spades, hearts, diamonds, or clubs) and a rank (A, K, Q, J, T, 9, 8, 7, 6, 5, 4, 3, 2). Here, the letter T denotes the card whose rank is 10. Before making a bid, an experienced bridge player studies the number of high card points (hcp) in the hand, as well as the distribution (the number of cards in each suit). The hcp contributed by each card is completely determined by its rank as follows:
Rank hcp
A 4
K 3
Q 2
J 1
Others 0

For example, if the hand is:

Hearts: K, J, T, 9, 2
Diamonds: 3
Clubs: K, Q, 7, 4, 3

Then this hand has 13 hcp and a distribution of 5-5-2-1 (the distribution is usually listed in non-increasing order). A balanced distribution is any one of 4-3-3-3, 4-4-3-2, and 5-3-3-2.

In bridge, an opening bid is either "pass" or consists of a level (1-7) and a trump suit. The trump suits are no trump, spades, hearts, diamonds, clubs ranked in decreasing order. Once a hand has been evaluated, the player applies the following list of (simplified) rules to determine the appropriate opening bid. In cases where multiple rules apply, the first one that applies should be used. An "x" in a distribution can be substituted with any non-negative number. Multiple "x"s in a distribution are not necessarily the same.

1. With at least 10 hcp and a y-x-x-x distribution (y >= 8), bid the suit with y cards at the 4 level. This is known as a preemptive bid.
2. With 10-13 hcp and a 7-x-x-x distribution, bid the suit with 7 cards at the 3-level. This is known as a preemptive bid.
3. With 8-9 hcp and a y-x-x-x distribution (y >= 7), bid the suit with y cards at the 2-level if the y-card suit is Spades or Hearts. This is known as a "weak-two" bid.
4. With 8-11 hcp and a 6-x-x-x distribution, in which Spades or Hearts is one of the 6-card suits, bid the higher rank suit at the 2 level. This is known as a "weak-two" bid.
5. With 11-15 hcp, a distribution of 4-4-4-1 or 5-4-4-0, and at least 4 spades, bid Diamonds at the 2 level. This is called the "Mini Roman Convention".
6. With 15-17 hcp and a balanced distribution, bid No Trump at the 1 level provided that at least 3 suits are "stopped." A suit is considered stopped if the suit contains at least one of the following:

an A;
a K and one other;
a Q and two others; or
a J and three others;

1. With 20-22 hcp and a balanced distribution, bid No Trump at the 2 level. 8.With at least 22 hcp, bid Clubs at the 2 level.
2. With 13-16 hcp:
a. If there is a 5-card or longer suit in Spades or Hearts, bid it at the 1 level. If both bids are possible, bid the longer suit. If both suits have the same length, bid the higher ranking suit.
b. Without a 5-card suit in Spades or Hearts, bid the longer of Diamonds or Clubs at the 1 level (whichever one has the most number of cards) . If there is a tie, bid the higher ranking suit.

3. With at least 17 hcp, bid the longest suit at the 1 level. If there is a tie, bid the lowest ranking suit. This is known as a "reverse".

4. If none of the rules above is applicable, bid Pass.

In the example above, rule 9a applies and a bid of 1 Hearts should be made.

Input
The input consists of a number of cases. The bridge hand for each case is specified on one line, with a single space separating each of the 13 cards in the hand. Each card is given as a two-character string. The first letter is the suit (S, H, D, C) and the second character is the rank (A, K, Q, J, T, 9, 8, 7, 6, 5, 4, 3, 2). The end of input is terminated by end-of-file.

Output
For each case, print the hand number (starting from 1), followed by a colon and a space, and then the suggested bid on a single line (see below for the exact format). Each bid is either "Pass" or a level and a suit ("No Trump", "Spades", "Hearts", "Diamonds", "Clubs") separated by a single space.

Sample Input
SA S2 HK HJ HT H9 H2 D3 CK CQ C7 C4 C3
SK SQ HT H8 H4 CA CQ CT C5 DK DQ DJ D8
SA SK SQ S3 S2 HT D7 D9 CA CK CQ C7 C5

Sample Output
Hand #1: 1 Hearts
Hand #2: 1 No Trump
Hand #3: 1 Clubs

Problem Description Bridge is a very complicated card game, and the bidding part is particularly difficult to master. The bidding is made even more difficult because players use different bidding conventions (meanings assigned to bids). In this problem, you are asked to write a program that suggests the first bid that should be made. The bidding conventions described below are simplified from those used by a certain person who shall remain nameless. A bridge hand consists of 13 cards. Each card has a suit (spades, hearts, diamonds, or clubs) and a rank (A, K, Q, J, T, 9, 8, 7, 6, 5, 4, 3, 2). Here, the letter T denotes the card whose rank is 10. Before making a bid, an experienced bridge player studies the number of high card points (hcp) in the hand, as well as the distribution (the number of cards in each suit). The hcp contributed by each card is completely determined by its rank as follows: Rank hcp A 4 K 3 Q 2 J 1 Others 0 For example, if the hand is: Spades: A, 2 Hearts: K, J, T, 9, 2 Diamonds: 3 Clubs: K, Q, 7, 4, 3 Then this hand has 13 hcp and a distribution of 5-5-2-1 (the distribution is usually listed in non-increasing order). A balanced distribution is any one of 4-3-3-3, 4-4-3-2, and 5-3-3-2. In bridge, an opening bid is either "pass" or consists of a level (1-7) and a trump suit. The trump suits are no trump, spades, hearts, diamonds, clubs ranked in decreasing order. Once a hand has been evaluated, the player applies the following list of (simplified) rules to determine the appropriate opening bid. In cases where multiple rules apply, the first one that applies should be used. An "x" in a distribution can be substituted with any non-negative number. Multiple "x"s in a distribution are not necessarily the same. 1. With at least 10 hcp and a y-x-x-x distribution (y >= 8), bid the suit with y cards at the 4 level. This is known as a preemptive bid. 2. With 10-13 hcp and a 7-x-x-x distribution, bid the suit with 7 cards at the 3-level. This is known as a preemptive bid. 3. With 8-9 hcp and a y-x-x-x distribution (y >= 7), bid the suit with y cards at the 2-level if the y-card suit is Spades or Hearts. This is known as a "weak-two" bid. 4. With 8-11 hcp and a 6-x-x-x distribution, in which Spades or Hearts is one of the 6-card suits, bid the higher rank suit at the 2 level. This is known as a "weak-two" bid. 5. With 11-15 hcp, a distribution of 4-4-4-1 or 5-4-4-0, and at least 4 spades, bid Diamonds at the 2 level. This is called the "Mini Roman Convention". 6. With 15-17 hcp and a balanced distribution, bid No Trump at the 1 level provided that at least 3 suits are "stopped." A suit is considered stopped if the suit contains at least one of the following: an A; a K and one other; a Q and two others; or a J and three others; 7. With 20-22 hcp and a balanced distribution, bid No Trump at the 2 level. 8.With at least 22 hcp, bid Clubs at the 2 level. 9. With 13-16 hcp: a. If there is a 5-card or longer suit in Spades or Hearts, bid it at the 1 level. If both bids are possible, bid the longer suit. If both suits have the same length, bid the higher ranking suit. b. Without a 5-card suit in Spades or Hearts, bid the longer of Diamonds or Clubs at the 1 level (whichever one has the most number of cards) . If there is a tie, bid the higher ranking suit. 10. With at least 17 hcp, bid the longest suit at the 1 level. If there is a tie, bid the lowest ranking suit. This is known as a "reverse". 11. If none of the rules above is applicable, bid Pass. In the example above, rule 9a applies and a bid of 1 Hearts should be made. Input The input consists of a number of cases. The bridge hand for each case is specified on one line, with a single space separating each of the 13 cards in the hand. Each card is given as a two-character string. The first letter is the suit (S, H, D, C) and the second character is the rank (A, K, Q, J, T, 9, 8, 7, 6, 5, 4, 3, 2). The end of input is terminated by end-of-file. Output For each case, print the hand number (starting from 1), followed by a colon and a space, and then the suggested bid on a single line (see below for the exact format). Each bid is either "Pass" or a level and a suit ("No Trump", "Spades", "Hearts", "Diamonds", "Clubs") separated by a single space. Sample Input SA S2 HK HJ HT H9 H2 D3 CK CQ C7 C4 C3 SK SQ HT H8 H4 CA CQ CT C5 DK DQ DJ D8 SA SK SQ S3 S2 HT D7 D9 CA CK CQ C7 C5 Sample Output Hand #1: 1 Hearts Hand #2: 1 No Trump Hand #3: 1 Clubs

Problem Description Bridge is a very complicated card game, and the bidding part is particularly difficult to master. The bidding is made even more difficult because players use different bidding conventions (meanings assigned to bids). In this problem, you are asked to write a program that suggests the first bid that should be made. The bidding conventions described below are simplified from those used by a certain person who shall remain nameless. A bridge hand consists of 13 cards. Each card has a suit (spades, hearts, diamonds, or clubs) and a rank (A, K, Q, J, T, 9, 8, 7, 6, 5, 4, 3, 2). Here, the letter T denotes the card whose rank is 10. Before making a bid, an experienced bridge player studies the number of high card points (hcp) in the hand, as well as the distribution (the number of cards in each suit). The hcp contributed by each card is completely determined by its rank as follows: Rank hcp A 4 K 3 Q 2 J 1 Others 0 For example, if the hand is: Spades: A, 2 Hearts: K, J, T, 9, 2 Diamonds: 3 Clubs: K, Q, 7, 4, 3 Then this hand has 13 hcp and a distribution of 5-5-2-1 (the distribution is usually listed in non-increasing order). A balanced distribution is any one of 4-3-3-3, 4-4-3-2, and 5-3-3-2. In bridge, an opening bid is either "pass" or consists of a level (1-7) and a trump suit. The trump suits are no trump, spades, hearts, diamonds, clubs ranked in decreasing order. Once a hand has been evaluated, the player applies the following list of (simplified) rules to determine the appropriate opening bid. In cases where multiple rules apply, the first one that applies should be used. An "x" in a distribution can be substituted with any non-negative number. Multiple "x"s in a distribution are not necessarily the same. 1. With at least 10 hcp and a y-x-x-x distribution (y >= 8), bid the suit with y cards at the 4 level. This is known as a preemptive bid. 2. With 10-13 hcp and a 7-x-x-x distribution, bid the suit with 7 cards at the 3-level. This is known as a preemptive bid. 3. With 8-9 hcp and a y-x-x-x distribution (y >= 7), bid the suit with y cards at the 2-level if the y-card suit is Spades or Hearts. This is known as a "weak-two" bid. 4. With 8-11 hcp and a 6-x-x-x distribution, in which Spades or Hearts is one of the 6-card suits, bid the higher rank suit at the 2 level. This is known as a "weak-two" bid. 5. With 11-15 hcp, a distribution of 4-4-4-1 or 5-4-4-0, and at least 4 spades, bid Diamonds at the 2 level. This is called the "Mini Roman Convention". 6. With 15-17 hcp and a balanced distribution, bid No Trump at the 1 level provided that at least 3 suits are "stopped." A suit is considered stopped if the suit contains at least one of the following: an A; a K and one other; a Q and two others; or a J and three others; 7. With 20-22 hcp and a balanced distribution, bid No Trump at the 2 level. 8.With at least 22 hcp, bid Clubs at the 2 level. 9. With 13-16 hcp: a. If there is a 5-card or longer suit in Spades or Hearts, bid it at the 1 level. If both bids are possible, bid the longer suit. If both suits have the same length, bid the higher ranking suit. b. Without a 5-card suit in Spades or Hearts, bid the longer of Diamonds or Clubs at the 1 level (whichever one has the most number of cards) . If there is a tie, bid the higher ranking suit. 10. With at least 17 hcp, bid the longest suit at the 1 level. If there is a tie, bid the lowest ranking suit. This is known as a "reverse". 11. If none of the rules above is applicable, bid Pass. In the example above, rule 9a applies and a bid of 1 Hearts should be made. Input The input consists of a number of cases. The bridge hand for each case is specified on one line, with a single space separating each of the 13 cards in the hand. Each card is given as a two-character string. The first letter is the suit (S, H, D, C) and the second character is the rank (A, K, Q, J, T, 9, 8, 7, 6, 5, 4, 3, 2). The end of input is terminated by end-of-file. Output For each case, print the hand number (starting from 1), followed by a colon and a space, and then the suggested bid on a single line (see below for the exact format). Each bid is either "Pass" or a level and a suit ("No Trump", "Spades", "Hearts", "Diamonds", "Clubs") separated by a single space. Sample Input SA S2 HK HJ HT H9 H2 D3 CK CQ C7 C4 C3 SK SQ HT H8 H4 CA CQ CT C5 DK DQ DJ D8 SA SK SQ S3 S2 HT D7 D9 CA CK CQ C7 C5 Sample Output Hand #1: 1 Hearts Hand #2: 1 No Trump Hand #3: 1 Clubs

Problem Description Bridge is a very complicated card game, and the bidding part is particularly difficult to master. The bidding is made even more difficult because players use different bidding conventions (meanings assigned to bids). In this problem, you are asked to write a program that suggests the first bid that should be made. The bidding conventions described below are simplified from those used by a certain person who shall remain nameless. A bridge hand consists of 13 cards. Each card has a suit (spades, hearts, diamonds, or clubs) and a rank (A, K, Q, J, T, 9, 8, 7, 6, 5, 4, 3, 2). Here, the letter T denotes the card whose rank is 10. Before making a bid, an experienced bridge player studies the number of high card points (hcp) in the hand, as well as the distribution (the number of cards in each suit). The hcp contributed by each card is completely determined by its rank as follows: Rank hcp A 4 K 3 Q 2 J 1 Others 0 For example, if the hand is: Spades: A, 2 Hearts: K, J, T, 9, 2 Diamonds: 3 Clubs: K, Q, 7, 4, 3 Then this hand has 13 hcp and a distribution of 5-5-2-1 (the distribution is usually listed in non-increasing order). A balanced distribution is any one of 4-3-3-3, 4-4-3-2, and 5-3-3-2. In bridge, an opening bid is either "pass" or consists of a level (1-7) and a trump suit. The trump suits are no trump, spades, hearts, diamonds, clubs ranked in decreasing order. Once a hand has been evaluated, the player applies the following list of (simplified) rules to determine the appropriate opening bid. In cases where multiple rules apply, the first one that applies should be used. An "x" in a distribution can be substituted with any non-negative number. Multiple "x"s in a distribution are not necessarily the same. 1. With at least 10 hcp and a y-x-x-x distribution (y >= 8), bid the suit with y cards at the 4 level. This is known as a preemptive bid. 2. With 10-13 hcp and a 7-x-x-x distribution, bid the suit with 7 cards at the 3-level. This is known as a preemptive bid. 3. With 8-9 hcp and a y-x-x-x distribution (y >= 7), bid the suit with y cards at the 2-level if the y-card suit is Spades or Hearts. This is known as a "weak-two" bid. 4. With 8-11 hcp and a 6-x-x-x distribution, in which Spades or Hearts is one of the 6-card suits, bid the higher rank suit at the 2 level. This is known as a "weak-two" bid. 5. With 11-15 hcp, a distribution of 4-4-4-1 or 5-4-4-0, and at least 4 spades, bid Diamonds at the 2 level. This is called the "Mini Roman Convention". 6. With 15-17 hcp and a balanced distribution, bid No Trump at the 1 level provided that at least 3 suits are "stopped." A suit is considered stopped if the suit contains at least one of the following: an A; a K and one other; a Q and two others; or a J and three others; 7. With 20-22 hcp and a balanced distribution, bid No Trump at the 2 level. 8.With at least 22 hcp, bid Clubs at the 2 level. 9. With 13-16 hcp: a. If there is a 5-card or longer suit in Spades or Hearts, bid it at the 1 level. If both bids are possible, bid the longer suit. If both suits have the same length, bid the higher ranking suit. b. Without a 5-card suit in Spades or Hearts, bid the longer of Diamonds or Clubs at the 1 level (whichever one has the most number of cards) . If there is a tie, bid the higher ranking suit. 10. With at least 17 hcp, bid the longest suit at the 1 level. If there is a tie, bid the lowest ranking suit. This is known as a "reverse". 11. If none of the rules above is applicable, bid Pass. In the example above, rule 9a applies and a bid of 1 Hearts should be made. Input The input consists of a number of cases. The bridge hand for each case is specified on one line, with a single space separating each of the 13 cards in the hand. Each card is given as a two-character string. The first letter is the suit (S, H, D, C) and the second character is the rank (A, K, Q, J, T, 9, 8, 7, 6, 5, 4, 3, 2). The end of input is terminated by end-of-file. Output For each case, print the hand number (starting from 1), followed by a colon and a space, and then the suggested bid on a single line (see below for the exact format). Each bid is either "Pass" or a level and a suit ("No Trump", "Spades", "Hearts", "Diamonds", "Clubs") separated by a single space. Sample Input SA S2 HK HJ HT H9 H2 D3 CK CQ C7 C4 C3 SK SQ HT H8 H4 CA CQ CT C5 DK DQ DJ D8 SA SK SQ S3 S2 HT D7 D9 CA CK CQ C7 C5 Sample Output Hand #1: 1 Hearts Hand #2: 1 No Trump Hand #3: 1 Clubs
Bridge Bidding的C语言的解法
Problem Description Bridge is a very complicated card game, and the bidding part is particularly difficult to master. The bidding is made even more difficult because players use different bidding conventions (meanings assigned to bids). In this problem, you are asked to write a program that suggests the first bid that should be made. The bidding conventions described below are simplified from those used by a certain person who shall remain nameless. A bridge hand consists of 13 cards. Each card has a suit (spades, hearts, diamonds, or clubs) and a rank (A, K, Q, J, T, 9, 8, 7, 6, 5, 4, 3, 2). Here, the letter T denotes the card whose rank is 10. Before making a bid, an experienced bridge player studies the number of high card points (hcp) in the hand, as well as the distribution (the number of cards in each suit). The hcp contributed by each card is completely determined by its rank as follows: Rank hcp A 4 K 3 Q 2 J 1 Others 0 For example, if the hand is: Spades: A, 2 Hearts: K, J, T, 9, 2 Diamonds: 3 Clubs: K, Q, 7, 4, 3 Then this hand has 13 hcp and a distribution of 5-5-2-1 (the distribution is usually listed in non-increasing order). A balanced distribution is any one of 4-3-3-3, 4-4-3-2, and 5-3-3-2. In bridge, an opening bid is either "pass" or consists of a level (1-7) and a trump suit. The trump suits are no trump, spades, hearts, diamonds, clubs ranked in decreasing order. Once a hand has been evaluated, the player applies the following list of (simplified) rules to determine the appropriate opening bid. In cases where multiple rules apply, the first one that applies should be used. An "x" in a distribution can be substituted with any non-negative number. Multiple "x"s in a distribution are not necessarily the same. 1. With at least 10 hcp and a y-x-x-x distribution (y >= 8), bid the suit with y cards at the 4 level. This is known as a preemptive bid. 2. With 10-13 hcp and a 7-x-x-x distribution, bid the suit with 7 cards at the 3-level. This is known as a preemptive bid. 3. With 8-9 hcp and a y-x-x-x distribution (y >= 7), bid the suit with y cards at the 2-level if the y-card suit is Spades or Hearts. This is known as a "weak-two" bid. 4. With 8-11 hcp and a 6-x-x-x distribution, in which Spades or Hearts is one of the 6-card suits, bid the higher rank suit at the 2 level. This is known as a "weak-two" bid. 5. With 11-15 hcp, a distribution of 4-4-4-1 or 5-4-4-0, and at least 4 spades, bid Diamonds at the 2 level. This is called the "Mini Roman Convention". 6. With 15-17 hcp and a balanced distribution, bid No Trump at the 1 level provided that at least 3 suits are "stopped." A suit is considered stopped if the suit contains at least one of the following: an A; a K and one other; a Q and two others; or a J and three others; 7. With 20-22 hcp and a balanced distribution, bid No Trump at the 2 level. 8.With at least 22 hcp, bid Clubs at the 2 level. 9. With 13-16 hcp: a. If there is a 5-card or longer suit in Spades or Hearts, bid it at the 1 level. If both bids are possible, bid the longer suit. If both suits have the same length, bid the higher ranking suit. b. Without a 5-card suit in Spades or Hearts, bid the longer of Diamonds or Clubs at the 1 level (whichever one has the most number of cards) . If there is a tie, bid the higher ranking suit. 10. With at least 17 hcp, bid the longest suit at the 1 level. If there is a tie, bid the lowest ranking suit. This is known as a "reverse". 11. If none of the rules above is applicable, bid Pass. In the example above, rule 9a applies and a bid of 1 Hearts should be made. Input The input consists of a number of cases. The bridge hand for each case is specified on one line, with a single space separating each of the 13 cards in the hand. Each card is given as a two-character string. The first letter is the suit (S, H, D, C) and the second character is the rank (A, K, Q, J, T, 9, 8, 7, 6, 5, 4, 3, 2). The end of input is terminated by end-of-file. Output For each case, print the hand number (starting from 1), followed by a colon and a space, and then the suggested bid on a single line (see below for the exact format). Each bid is either "Pass" or a level and a suit ("No Trump", "Spades", "Hearts", "Diamonds", "Clubs") separated by a single space. Sample Input SA S2 HK HJ HT H9 H2 D3 CK CQ C7 C4 C3 SK SQ HT H8 H4 CA CQ CT C5 DK DQ DJ D8 SA SK SQ S3 S2 HT D7 D9 CA CK CQ C7 C5 Sample Output Hand #1: 1 Hearts Hand #2: 1 No Trump Hand #3: 1 Clubs
Bridge Bidding 代码设计问题
Problem Description Bridge is a very complicated card game, and the bidding part is particularly difficult to master. The bidding is made even more difficult because players use different bidding conventions (meanings assigned to bids). In this problem, you are asked to write a program that suggests the first bid that should be made. The bidding conventions described below are simplified from those used by a certain person who shall remain nameless. A bridge hand consists of 13 cards. Each card has a suit (spades, hearts, diamonds, or clubs) and a rank (A, K, Q, J, T, 9, 8, 7, 6, 5, 4, 3, 2). Here, the letter T denotes the card whose rank is 10. Before making a bid, an experienced bridge player studies the number of high card points (hcp) in the hand, as well as the distribution (the number of cards in each suit). The hcp contributed by each card is completely determined by its rank as follows: Rank hcp A 4 K 3 Q 2 J 1 Others 0 For example, if the hand is: Spades: A, 2 Hearts: K, J, T, 9, 2 Diamonds: 3 Clubs: K, Q, 7, 4, 3 Then this hand has 13 hcp and a distribution of 5-5-2-1 (the distribution is usually listed in non-increasing order). A balanced distribution is any one of 4-3-3-3, 4-4-3-2, and 5-3-3-2. In bridge, an opening bid is either "pass" or consists of a level (1-7) and a trump suit. The trump suits are no trump, spades, hearts, diamonds, clubs ranked in decreasing order. Once a hand has been evaluated, the player applies the following list of (simplified) rules to determine the appropriate opening bid. In cases where multiple rules apply, the first one that applies should be used. An "x" in a distribution can be substituted with any non-negative number. Multiple "x"s in a distribution are not necessarily the same. 1. With at least 10 hcp and a y-x-x-x distribution (y >= 8), bid the suit with y cards at the 4 level. This is known as a preemptive bid. 2. With 10-13 hcp and a 7-x-x-x distribution, bid the suit with 7 cards at the 3-level. This is known as a preemptive bid. 3. With 8-9 hcp and a y-x-x-x distribution (y >= 7), bid the suit with y cards at the 2-level if the y-card suit is Spades or Hearts. This is known as a "weak-two" bid. 4. With 8-11 hcp and a 6-x-x-x distribution, in which Spades or Hearts is one of the 6-card suits, bid the higher rank suit at the 2 level. This is known as a "weak-two" bid. 5. With 11-15 hcp, a distribution of 4-4-4-1 or 5-4-4-0, and at least 4 spades, bid Diamonds at the 2 level. This is called the "Mini Roman Convention". 6. With 15-17 hcp and a balanced distribution, bid No Trump at the 1 level provided that at least 3 suits are "stopped." A suit is considered stopped if the suit contains at least one of the following: an A; a K and one other; a Q and two others; or a J and three others; 7. With 20-22 hcp and a balanced distribution, bid No Trump at the 2 level. 8.With at least 22 hcp, bid Clubs at the 2 level. 9. With 13-16 hcp: a. If there is a 5-card or longer suit in Spades or Hearts, bid it at the 1 level. If both bids are possible, bid the longer suit. If both suits have the same length, bid the higher ranking suit. b. Without a 5-card suit in Spades or Hearts, bid the longer of Diamonds or Clubs at the 1 level (whichever one has the most number of cards) . If there is a tie, bid the higher ranking suit. 10. With at least 17 hcp, bid the longest suit at the 1 level. If there is a tie, bid the lowest ranking suit. This is known as a "reverse". 11. If none of the rules above is applicable, bid Pass. In the example above, rule 9a applies and a bid of 1 Hearts should be made. Input The input consists of a number of cases. The bridge hand for each case is specified on one line, with a single space separating each of the 13 cards in the hand. Each card is given as a two-character string. The first letter is the suit (S, H, D, C) and the second character is the rank (A, K, Q, J, T, 9, 8, 7, 6, 5, 4, 3, 2). The end of input is terminated by end-of-file. Output For each case, print the hand number (starting from 1), followed by a colon and a space, and then the suggested bid on a single line (see below for the exact format). Each bid is either "Pass" or a level and a suit ("No Trump", "Spades", "Hearts", "Diamonds", "Clubs") separated by a single space. Sample Input SA S2 HK HJ HT H9 H2 D3 CK CQ C7 C4 C3 SK SQ HT H8 H4 CA CQ CT C5 DK DQ DJ D8 SA SK SQ S3 S2 HT D7 D9 CA CK CQ C7 C5 Sample Output Hand #1: 1 Hearts Hand #2: 1 No Trump Hand #3: 1 Clubs
C#调用cxf写的webservice
public static void main(String[] args) { JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance(); //创建client，wsdlUrl地址格式：业务协同管理平台访问地址+/services/yinHaiBusiness?wsdl Client client = dcf.createClient("http://10.200.30.23:8001/xtpt/services/yinHaiBusiness?wsdl"); HTTPConduit http = (HTTPConduit) client.getConduit(); //设置连接超时参数 HTTPClientPolicy hcp = new HTTPClientPolicy(); hcp.setConnectionTimeout(2000); hcp.setReceiveTimeout(200000); http.setClient(hcp); //参数xml，最外层必须是input节点 String aac002 = "652101196406210414"; String jybh ="Q001"; String nd ="2016"; String aae041 ="200801"; String aae042 ="201706"; String xmlInput="<input><aac002>"+aac002+"</aac002><nd>"+nd+"</nd><aae041>"+aae041+"</aae041><aae042>"+aae042+"</aae042><yac005>"+0123456+"</yac005><jybh>"+jybh+"</jybh></input>"; //设置SOAP头信息 /** AddSoapHeader 构造函数说明：1、协同平台webservice服务命名空间:http://yinhai.com ** 2、接入系统标识 * 3、参数 * 4、参数签名 * 5、服务标识 **/ try{ client.getOutInterceptors().add(new AddSoapHeader("http://yinhai.com","CCB_SelfHelp",xmlInput, RSAUtils.sign(xmlInput,"CCB_SelfHelp.keystore"),"TaService")); //发起调用 Object[] obj= client.invoke("callBusiness", xmlInput); //获取返回结果(XML格式) Object result = obj[0]; System.out.println(result); }catch(Exception e){ System.out.println(e.getMessage()); } } 这个是用java写的调用那个webservice的方法的参考事例，现在我需要用c#来实现，求方法，主要是在c#里如何实现java的getOutInterceptors
Bridge Bidding
Problem Description Bridge is a very complicated card game, and the bidding part is particularly difficult to master. The bidding is made even more difficult because players use different bidding conventions (meanings assigned to bids). In this problem, you are asked to write a program that suggests the first bid that should be made. The bidding conventions described below are simplified from those used by a certain person who shall remain nameless. A bridge hand consists of 13 cards. Each card has a suit (spades, hearts, diamonds, or clubs) and a rank (A, K, Q, J, T, 9, 8, 7, 6, 5, 4, 3, 2). Here, the letter T denotes the card whose rank is 10. Before making a bid, an experienced bridge player studies the number of high card points (hcp) in the hand, as well as the distribution (the number of cards in each suit). The hcp contributed by each card is completely determined by its rank as follows: Rank hcp A 4 K 3 Q 2 J 1 Others 0 For example, if the hand is: Spades: A, 2 Hearts: K, J, T, 9, 2 Diamonds: 3 Clubs: K, Q, 7, 4, 3 Then this hand has 13 hcp and a distribution of 5-5-2-1 (the distribution is usually listed in non-increasing order). A balanced distribution is any one of 4-3-3-3, 4-4-3-2, and 5-3-3-2. In bridge, an opening bid is either "pass" or consists of a level (1-7) and a trump suit. The trump suits are no trump, spades, hearts, diamonds, clubs ranked in decreasing order. Once a hand has been evaluated, the player applies the following list of (simplified) rules to determine the appropriate opening bid. In cases where multiple rules apply, the first one that applies should be used. An "x" in a distribution can be substituted with any non-negative number. Multiple "x"s in a distribution are not necessarily the same. 1. With at least 10 hcp and a y-x-x-x distribution (y >= 8), bid the suit with y cards at the 4 level. This is known as a preemptive bid. 2. With 10-13 hcp and a 7-x-x-x distribution, bid the suit with 7 cards at the 3-level. This is known as a preemptive bid. 3. With 8-9 hcp and a y-x-x-x distribution (y >= 7), bid the suit with y cards at the 2-level if the y-card suit is Spades or Hearts. This is known as a "weak-two" bid. 4. With 8-11 hcp and a 6-x-x-x distribution, in which Spades or Hearts is one of the 6-card suits, bid the higher rank suit at the 2 level. This is known as a "weak-two" bid. 5. With 11-15 hcp, a distribution of 4-4-4-1 or 5-4-4-0, and at least 4 spades, bid Diamonds at the 2 level. This is called the "Mini Roman Convention". 6. With 15-17 hcp and a balanced distribution, bid No Trump at the 1 level provided that at least 3 suits are "stopped." A suit is considered stopped if the suit contains at least one of the following: an A; a K and one other; a Q and two others; or a J and three others; 7. With 20-22 hcp and a balanced distribution, bid No Trump at the 2 level. 8.With at least 22 hcp, bid Clubs at the 2 level. 9. With 13-16 hcp: a. If there is a 5-card or longer suit in Spades or Hearts, bid it at the 1 level. If both bids are possible, bid the longer suit. If both suits have the same length, bid the higher ranking suit. b. Without a 5-card suit in Spades or Hearts, bid the longer of Diamonds or Clubs at the 1 level (whichever one has the most number of cards) . If there is a tie, bid the higher ranking suit. 10. With at least 17 hcp, bid the longest suit at the 1 level. If there is a tie, bid the lowest ranking suit. This is known as a "reverse". 11. If none of the rules above is applicable, bid Pass. In the example above, rule 9a applies and a bid of 1 Hearts should be made. Input The input consists of a number of cases. The bridge hand for each case is specified on one line, with a single space separating each of the 13 cards in the hand. Each card is given as a two-character string. The first letter is the suit (S, H, D, C) and the second character is the rank (A, K, Q, J, T, 9, 8, 7, 6, 5, 4, 3, 2). The end of input is terminated by end-of-file. Output For each case, print the hand number (starting from 1), followed by a colon and a space, and then the suggested bid on a single line (see below for the exact format). Each bid is either "Pass" or a level and a suit ("No Trump", "Spades", "Hearts", "Diamonds", "Clubs") separated by a single space. Sample Input SA S2 HK HJ HT H9 H2 D3 CK CQ C7 C4 C3 SK SQ HT H8 H4 CA CQ CT C5 DK DQ DJ D8 SA SK SQ S3 S2 HT D7 D9 CA CK CQ C7 C5 Sample Output Hand #1: 1 Hearts Hand #2: 1 No Trump Hand #3: 1 Clubs
CXF webservice传递复杂对象Map
1. 用cxf写了一个webservice，测试的时候可以传入String,为了传入Map，写了转换类，在Myeclipse10上是可以传Map的，现在项目用的是2014，用maven搭建的，移植的时候发现不能传Map了，求大神指教，下面上图 配置文件 ![图片说明](https://img-ask.csdn.net/upload/201610/26/1477449168_232536.png) service ``` @WebService @SOAPBinding(style=Style.RPC) public interface TestService { public String test(String s); public String sendMap(@XmlJavaTypeAdapter(StringObjectMapAdapter.class) Map<String, Object> data); } ``` 实现类 @WebService @SOAPBinding(style=Style.RPC) public class TestServiceImpl implements TestService { @Override public String test(String s) { return s; } @Override public String sendMap(@XmlJavaTypeAdapter(StringObjectMapAdapter.class) Map<String, Object> data) { return data.toString(); } } ``` ``` 转换类和转换类型类 public class Data { private List<Entry> list = new ArrayList<Entry>(); public void addEntry(String fieldName, Object fieldValue) { Entry entry = new Entry(); entry.setKey(fieldName); entry.setValue(fieldValue); list.add(entry); } public List<Entry> getList() { return list; } public void setList(List<Entry> list) { this.list = list; } public static class Entry { private String key; private Object value; public String getKey() { return key; } public void setKey(String key) { this.key = key; } public Object getValue() { return value; } public void setValue(Object value) { this.value = value; } } } ``` public class StringObjectMapAdapter extends XmlAdapter<Data, Map<String, Object>> { @Override public Map<String, Object> unmarshal(Data data) throws Exception { Map<String, Object> map = new HashMap<String, Object>(); for (Data.Entry entry : data.getList()) { map.put(entry.getKey(), entry.getValue()); } return map; } @Override public Data marshal(Map<String, Object> map) throws Exception { Data data = new Data(); for (Map.Entry<String, Object> entry : map.entrySet()) { data.addEntry(entry.getKey(), entry.getValue()); } return data; } } ``` 客户端测试类 public class ClientTest { public static void main(String[] args) { JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance(); //webservice地址 String path = "http://127.0.0.1:8080/Demo/services/TestService?wsdl"; // 创建客户端连接 Client client = dcf.createClient(path); HTTPConduit http = (HTTPConduit) client.getConduit(); HTTPClientPolicy hcp = new HTTPClientPolicy(); hcp.setConnectionTimeout(2000);//连接超时 hcp.setReceiveTimeout(200000);//请求超时 http.setClient(hcp); Object[] obj = null; Map map = new HashMap<String,Object>(); map.put("a", "111"); try { //将map序列化后调用接口方法 Data map1 = new StringObjectMapAdapter().marshal(map); // obj = client.invoke("sendMap", map1); obj = client.invoke("sendMap", map); } catch (Exception e) { } String returnData = obj[0].toString();//返回的数据串 System.out.println(returnData); } }

《奇巧淫技》系列-python！！每天早上八点自动发送天气预报邮件到QQ邮箱

YOLO 是我非常喜欢的目标检测算法，堪称工业级的目标检测，能够达到实时的要求，它帮我解决了许多实际问题。 这就是 YOLO 的目标检测效果。它定位了图像中物体的位置，当然，也能预测物体的类别。 之前我有写博文介绍过它，但是每次重新读它的论文，我都有新的收获，为此我准备写一个系列的文章来详尽分析它。这是第一篇，从它的起始 YOLOv1 讲起。 YOLOv1 的论文地址：https://www.c

20行Python代码爬取王者荣耀全英雄皮肤

2019年互联网寒冬，大批企业开始裁员，下图是网上流传的一张截图： 裁员不可避免，那如何才能做到不管大环境如何变化，自身不受影响呢？ 我们先来看一个有意思的故事，如果西游记取经团队需要裁员一名，会裁掉谁呢，为什么？ 西游记团队组成： 1.唐僧 作为团队teamleader，有很坚韧的品性和极高的原则性，不达目的不罢休，遇到任何问题，都没有退缩过，又很得上司支持和赏识(直接得到唐太宗的任命，既给
Python语言高频重点汇总
Python语言高频重点汇总 GitHub面试宝典仓库——点这里跳转 文章目录Python语言高频重点汇总**GitHub面试宝典仓库——点这里跳转**1. 函数-传参2. 元类3. @staticmethod和@classmethod两个装饰器4. 类属性和实例属性5. Python的自省6. 列表、集合、字典推导式7. Python中单下划线和双下划线8. 格式化字符串中的%和format9.

ES6基础-ES6的扩展

Python爬虫爬取淘宝，京东商品信息

Java工作4年来应聘要16K最后没要,细节如下。。。

Python爬虫精简步骤1 获取数据

CPU对每个程序员来说，是个既熟悉又陌生的东西？ 如果你只知道CPU是中央处理器的话，那可能对你并没有什么用，那么作为程序员的我们，必须要搞懂的就是CPU这家伙是如何运行的，尤其要搞懂它里面的寄存器是怎么一回事，因为这将让你从底层明白程序的运行机制。 随我一起，来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说，我们首先就要搞明白它是怎么回事，也就是它的内部构造，当然，CPU那么牛的一个东

2020年1月17日，国家统计局发布了2019年国民经济报告，报告中指出我国人口突破14亿。 猪哥的朋友圈被14亿人口刷屏，但是很多人并没有看到我国复杂的人口问题：老龄化、男女比例失衡、生育率下降、人口红利下降等。 今天我们就来分析一下我们国家的人口数据吧！ 更多有趣分析教程，扫描下方二维码关注vx公号「裸睡的猪」 即可查看！ 一、背景 1.人口突破14亿 2020年1月17日，国家统计局发布
web前端javascript+jquery知识点总结
Javascript javascript 在前端网页中占有非常重要的地位，可以用于验证表单，制作特效等功能，它是一种描述语言，也是一种基于对象（Object）和事件驱动并具有安全性的脚本语言 ，语法同java类似，是一种解释性语言，边执行边解释。 JavaScript的组成： ECMAScipt 用于描述: 语法，变量和数据类型，运算符，逻辑控制语句，关键字保留字，对象。 浏览器对象模型（Br
Qt实践录：开篇

B 站上有哪些很好的学习资源?

Web播放器解决了在手机浏览器和PC浏览器上播放音视频数据的问题，让视音频内容可以不依赖用户安装App，就能进行播放以及在社交平台进行传播。在视频业务大数据平台中，播放数据的统计分析非常重要，所以Web播放器在使用过程中，需要对其内部的数据进行收集并上报至服务端，此时，就需要对发生在其内部的一些播放行为进行事件监听。 那么Web播放器事件监听是怎么实现的呢？ 01 监听事件明细表 名
3万字总结，Mysql优化之精髓

1. 传统事件绑定和符合W3C标准的事件绑定有什么区别？ 传统事件绑定 &lt;div onclick=""&gt;123&lt;/div&gt; div1.onclick = function(){}; &lt;button onmouseover=""&gt;&lt;/button&gt; 注意： 如果给同一个元素绑定了两次或多次相同类型的事件，那么后面的绑定会覆盖前面的绑定 （不支持DOM事...
Python学习笔记（语法篇）

[Pyhon疫情大数据分析] 一.腾讯实时数据爬取、Matplotlib和Seaborn可视化分析全国各地区、某省各城市、新增趋势

2020程序员面试必备！58道精选面试题，这样学习，大厂没问题！

Python原来这么好学-1.1节:在windows中安装Python