ITP1_6_B: Finding Missing Cards

「ITP1_6_B: Finding Missing Cards」の編集履歴(バックアップ)一覧に戻る

ITP1_6_B: Finding Missing Cards - (2016/03/19 (土) 09:58:08) のソース

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_6_B

足りないトランプカードをこたえる問題。

 #include <stdio.h>
 #include<string.h>
  int charToNum[128];
 
 int main()
 {
	bool oks[4][14];
	charToNum['S']=0;
	charToNum['H']=1;
	charToNum['C']=2;
	charToNum['D']=3;
	memset(oks,false,sizeof(oks));
	int n;
	scanf("%d\n",&n);
	while(n--){
		int m;
		char c;
		scanf("%c %d\n",&c,&m);
		oks[charToNum[c]][m]=true;
	}
	char ts[4]={'S','H','C','D'};
	for(int i=0;i<4;i++){
		for(int j=1;j<=13;j++){
			if(oks[i][j]==false){
				printf("%c %d\n",ts[i],j);
			}
		}
	}
 }