ITP1_6_B: Finding Missing Cards


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

#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);
		}
	}
}
}
最終更新:2016年03月19日 09:58