Problem Description
Bull and Ox is a kind of card game, a total of 5 cards, the rules are as follows:
If the sum of the points of 3 cards cannot be found is a multiple of 10, then there is no bull;
If the sum of the points of 3 cards is a multiple of 10, then there are cows, the remaining two card points and 10 to take the remainder, the remainder is a few, is the number of cows, especially when the remainder is 0 cattle cattle;
For example: 1 2 3 4 5, 1 + 4 + 5 = 0 (mod), 2 + 3 = 5 (mod 10), for cattle 5.
Input
The first line enters an integer t (T <= 100), which indicates that there are several sets of data. Each group of data occupies a row, 5 numbers, and each number ranges from 1 to 10.
Output
See examples.
Sample Input
31 1 1 1 11 2 3 4 51 9 10 10 10
Sample Output
Case #1: Mei niucase #2: Niu 5Case #3: Niu Niu
1#include <stdio.h>2 intMainvoid)3 {4     inta[5];5     intN,o;6     intsum1;7     8      while(SCANF ("%d", &n)! =EOF)9     {Ten         if(n<= -) One         {             A              for(o=0; o<n;o++) -             { -                 intl,b; the                  for(l=0;l<5; l++) -                 { -scanf"%d",&b); -a[l]=b;  +                 } -                 intb1=0, b2=0; +                 intI,j,k,i1; A                 //Start for at                  for(i=0; i<=2; i++) -                 { -                      for(j=i+1; j<=3; J + +) -                     { -                          for(k=j+1; k<=4; k++) -                         { in                             if((A[i]+a[j]+a[k])%Ten==0) -                             { tob1=1; +sum1=0; -                                  for(i1=0; i1<=4; i1++) the                                 { *                                     if(i1!=i && i1!=j && i1!=k) $                                     {Panax Notoginsengsum1+=A[I1]; -                                     } the                                 } +                                 if(sum1%Ten==0) A                                 { theB2=1; +                                 }                             -                             }                         $                         }                         $                     } -}//End for -                 if(B1)//have cattle the                 { -                     if(B2)//Beef CattleWuyi                     { theprintf"Case #%d:niu niu\n", o+1); -                     } Wu                     Else -                     { Aboutprintf"Case #%d:niu%d\n", o+1, (sum1%Ten)); $                     } -                 } -                 Else//no cows . -                 { Aprintf"Case #%d:mei niu\n", o+1); +                 } the}//End for O -}//End for If $}//End for while the      the     return 1; the}
 Wuhan University of Science and Technology acm:1003:0 starting point algorithm 78--beef cattle