diff --git a/P10457.cpp b/P10457.cpp new file mode 100644 index 0000000..53cc2ab --- /dev/null +++ b/P10457.cpp @@ -0,0 +1,50 @@ +// 117 +#include +using namespace std; +map m; +char a[20][10]; +int cnt = 1, ans; +bool vis[20][10]; +int trans(char tmp) +{ + switch (tmp) + { + case 'A': + return 1; + case '0': + return 10; + case 'J': + return 11; + case 'Q': + return 12; + } + return tmp - '0'; +} +int main() +{ + for (int i = 1; i <= 13; i++) + for (int j = 1; j <= 4; j++) + cin >> a[i][j]; + while (cnt <= 4) + { + char tmp = a[13][cnt++]; + while (tmp != 'K') + { + int t = trans(tmp); + for (int i = 4; i >= 1; i--) + { + if (!vis[t][i]) + { + vis[t][i] = true, m[tmp]++; + if (m[tmp] == 4 && tmp != 'K') + ans++; + tmp = a[t][i]; + break; + } + } + t = trans(tmp); + } + } + cout << ans; + return 0; +} \ No newline at end of file