Xidianoj 1044 Fried Gold Flower

Source: Internet
Author: User

Title Description

Deep-fried gold is a popular poker game around the world, many people because of this game made home, and more people lose their homes. To help gamblers get rid of it, they now decide to send you to write a program that will help gamblers better understand the game.

Deep-fried gold flowers are simplified here: each person will get three cards randomly distributed (the number of points for each card is an integer range [1,9], with a maximum of 4 cards at the same point), and then the size is compared.

The way to compare sizes is this:

① Leopard: That is, three points of the same card, if both sides are leopards, then the large number of large, leopard greater than any other situation;

②: That is, three consecutive increments of cards, such as (4,5,6), (three-to-one), if both sides are CIS, the number of large-size, the child is greater than the pair and leaflets;

③ pairs: That is, two points the same card with a single card, such as (1,1,4), (2,2,5), if both sides are pairs, then the number of cards in pairs is large, if the pair is the same, then compare the size of the single sheet, the pair is larger than the single sheet;

④ Single sheet: That is three cards are not the above three kinds. The comparison of the size of a single sheet is to compare the largest number of points, and then compare the second largest number of points, and then compare the third largest.

Note is a special case, that is, 2,3,5 than most of the cards are small, but bigger than the leopard.

Your task is to tell the gambler how many situations can win each other for a given situation of the opponent. (4,5,6 and 5,4,6 such a case)

Input

There are multiple sets of input data, and the first behavior is a number T, which represents the T-group input data (0<t≤1000).

Next to the T-group data, each group of data for one row, 3 integers, indicating the opponent's card situation.

Output

For each set of data, output an integer on one line, indicating the number of cases that won the opponent.

--Text

Just one kind of situation, consider the past.

#include <cstdio>#include<cstring>#include<algorithm>#include<iostream>using namespacestd;intcard[4];intdanzhang[Ten] = {0,0,0,0,2,5,9, -, -, -};Long LongAns =0;BOOLcmpintAintb) {    return(A <=b);}voidSolve () {ans=0; Sort (Card+1, card+4, CMP); if(card[1] = = card[2]) {        if(card[2] = = card[3]){//BaoziAns = (9-card[1]) +1; }        Else{//Duizi            intTMP1 = (9-card[3]) +8*(9-card[1]);//duizi bi ta da            intTMP2 =7;//Shunzi            intTmp3 =8;//BaoziAns = tmp1 + tmp2 +Tmp3; }    }        Else {        if(card[2] = = card[3]){//Duizi            intTMP1 = (9-card[1]) +8*(9-card[3]);//Tongshang            intTMP2 =7; intTmp3 =8; Ans= Tmp1 + TMP2 +Tmp3; }             Else {            if(card[2] = = card[1] +1&& card[3] = = card[2] +1){//Shunzi                intTMP1 =7-card[1];//Shunzi                intTMP2 =9; Ans= Tmp1 +TMP2; }            Else{//Danzhang                intTMP1 =0, I; if(card[2] = = card[3] -1) {TMP1= card[2]-card[1] -2; }                ElseTMP1= card[2]-card[1] -1;  for(i=card[2]+1; i<card[3]-1; i++) {TMP1+ = i-1; }                if(card[2] < card[3] -1) Tmp1+ = card[3] -3;  for(i=card[3]+1; i<=9; i++) {TMP1+=Danzhang[i]; }                intTMP2 = the;//Duizi                intTmp3 =7;//Shunzi                intTmp4 =9;//BaoziAns = tmp1 + tmp2 + Tmp3 +Tmp4; }        }    }}intMain () {inttime,t; scanf ("%d",&T);  for(time=1; time<=t;time++) {scanf (" %d%d%d", &card[1],&card[2],&card[3]); //printf ("%d%d%d", card[0],card[1],card[2]);Solve (); printf ("%lld\n", ans); }        return 0;} 

Xidianoj 1044 Fried Gold Flower

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.