[ create a new paste ] login | about

Link: http://codepad.org/45oveU94    [ raw code | fork ]

C, pasted on Nov 22:
#include <stdio.h>
int main()
{
  int n,i,j,k,l,m;
  int cards[4][13]={0};
  char c;
  char buf[8];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    fgets(buf,sizeof(buf),stdin);
    m = sscanf(buf,"%c %d",&c,&l);
    if(m !=2){printf("Errror input format \n");}
    if(c=='S')cards[0][l]=1;
    else if(c=='H')cards[1][l]=1;
    else if(c=='C')cards[2][l]=1;
    else if(c=='D')cards[3][l]=1;
  }

  for(j=0;j<4;j++){
    for(k=0;k<13;k++){
      if(cards[j][k]==0){
	if(j==0)printf("S %d\n",k+1);
	else if(j==1)printf("H %d\n",k+1);
	else if(j==2)printf("C %d\n",k+1);
	else printf("D %d\n",k+1);
      }
    }
  }
  return 0;
}


Create a new paste based on this one


Comments: