<mosaic.cnfolio.com>
PROGRAM
  1. #include<stdio.h>
  2.  
  3. void main(void)
  4. {
  5.     int i, j, cardsDrawnP1, cardsDrawnP2, temp;
  6.    
  7.    
  8.     scanf("%d", &cardsDrawnP1);
  9.     int P1cards[cardsDrawnP1], P1cardsSorted[cardsDrawnP1];
  10.     for (i=0; i<=10; i++)
  11.     {
  12.         scanf("%d", &P1cards[i]);
  13.     }
  14.    
  15.     for (i = 0; i < cardsDrawnP1; i++)
  16.     {
  17.         for (j = 0; j < (cardsDrawnP1 - (i-1)); j++)
  18.         {
  19.             if (P1cards[j] > P1cards[j + 1])
  20.             {
  21.                 temp = P1cards[j];
  22.                 P1cards[j] = P1cards[j + 1];
  23.                 P1cards[j + 1] = temp;
  24.             }
  25.          }
  26.       }
  27.      
  28.      for(j=0;j<cardsDrawnP1-1;j++)
  29.      {
  30.        P1cardsSorted[j]=P1cards[cardsDrawnP1-j];
  31.      }
  32.      
  33.      for (i=0;i<cardsDrawnP1; i++)
  34.      {
  35.        printf("%d ", P1cards[i]);
  36.      }
  37. }
  38.  
  39.  
  40.  
  41. /* Pseudo Code,
  42.   Read inputs for P1number of cards and what number the cards where, insert into array.
  43.   Repeat for P2
  44.   number of cards in input = P1Cards and P2Cards
  45.   sort inputs into descending order
  46.   If card n > card (n + 1) then do nothing
  47.   If card n < card (n + 1) then move 1 to the right
  48.   repeat for all cards
  49.  
  50.   compare P1 Cardn and P2 Cardn
  51.   also set P1NumberOfCards and P2NumberOfCards
  52.   n = position of card
  53.   Winner subroutine
  54.   If P1 Cardn > P2 Cardn then
  55.   output P1 wins
  56.   Else
  57.   if P1 Card1 < P2 Card1 then
  58.   output P2 wins
  59.   Else
  60.   n + 1
  61.   P1NumberOfCards - 1
  62.   P2NumberOfCards - 1
  63.   If P1NumberOfCards = 0 and P2NumberOfCards > 0
  64.   output P2 Wins
  65.   If P1NumberOfCards > 0 and P2NumberOfCards = 0
  66.   output P1 Wins
  67.   goto Winner Soubroutine */