AcWing 117. 占卜DIY
原题链接
简单
作者:
wjie
,
2020-07-20 19:50:20
,
所有人可见
,
阅读 645
#include <iostream>
#include <cstdio>
using namespace std;
char card[14][4];
int sel[14];
int trans(char c)
{
if (c == 'J') return 11;
else if (c == 'Q') return 12;
else if (c == 'K') return 13;
else if (c == 'A') return 1;
else if (c == '0') return 10;
return c - '0';
}
int main()
{
for (int i = 1; i <= 13; ++i)
{
sel[i] = 4;
for (int j = 1; j <= 4; ++j) cin >> card[i][j];
}
sel[13] = 1;
int point = trans(card[13][sel[13]]);
sel[13]++;
while (sel[13] <= 5)
{
// cout << point << " " << sel[point] << endl;
if (point == 13) point = trans(card[13][sel[13]]), sel[13]++;
else sel[point]--, point = trans(card[point][sel[point]+1]);
}
int res = 0;
for (int i = 1; i <= 12; ++i)
{
if (!sel[i]) res++;
}
printf("%d", res);
return 0;
}