占卜DIY

题目地址

Code

#include<iostream>
#include<vector>
#include<map>
using namespace std;
struct Node {
	vector<char> v; int cnt;
}c[20];
map<char,int> mp;
int main()
{
	for(int i=2;i<=9;++i) mp[i+'0'] = i;
	mp['A'] = 1 ,mp['0'] = 10 ,mp['J'] = 11 ,mp['Q'] = 12 ,mp['K'] = 13;
	for(int i=1;i<=13;++i) {
		char c1,c2,c3,c4;
		cin>>c1>>c2>>c3>>c4;
		c[i].v.push_back(c4);
		c[i].v.push_back(c3);
		c[i].v.push_back(c2);
		c[i].v.push_back(c1);
	}
	for(int i=3;i>=0;--i) {
		char now = c[13].v[i];
		while(now != 'K') {
			c[mp[now]].v.push_back(now); c[mp[now]].cnt++;
			now = c[mp[now]].v[c[mp[now]].v.size()-5];
		}
	}
	int sum = 0;
	for(int i=1;i<=13;++i) {
		bool flag = 1;
		for(int j=1;j<=4;++j) {
			if(mp[c[i].v[c[i].v.size()-j]] != i) {
				flag = 0;
			}
		}
		if(flag && c[i].cnt==4) {
			++sum;
		}
	}
	printf("%d\n",sum);
	return 0;
}

大家可千万别学我,都快开学(8.31),也快CSP(还有70天),还在做模拟题。

posted @ 2019-08-31 17:16  基地AI  阅读(203)  评论(0编辑  收藏  举报