Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define pb push_back
- #define mp make_pair
- #define sz size
- #define ll long long
- #define ld long double
- #define fs first
- #define sc second
- #define forn(i, f, t) for(int i = f; i < t; i++)
- #define all(x) (x).begin(), (x).end()
- #define ins insert
- const int INF = 2147483647;
- const int MOD = 1000000007;
- const ll INF64 = 9223372036854775807;
- const ld EPS = 1e-7;
- using namespace std;
- int main(){
- pair<int, int> a[5], b[5];
- string t;
- forn(i, 0, 5){
- cin >> t;
- if (t[0] == 'T') a[i].fs = 10, b[i].fs = -3;
- else if (t[0] == 'J') a[i].fs = 11, b[i].fs = -2;
- else if (t[0] == 'Q') a[i].fs = 12, b[i].fs = -1;
- else if (t[0] == 'K') a[i].fs = 13, b[i].fs = 0;
- else if (t[0] == 'A') a[i].fs = 14, b[i].fs = 1;
- else a[i].fs = t[0] - '0', b[i].fs = t[0] - '0';
- if (t[1] == 'H') a[i].sc = 0, b[i].sc = 0;
- else if (t[1] == 'D') a[i].sc = 1, b[i].sc = 1;
- else if (t[1] == 'S') a[i].sc = 2, b[i].sc = 2;
- else if (t[1] == 'C') a[i].sc = 3, b[i].sc = 3;
- }
- sort(a, a + 5); sort(b, b + 5);
- bool f = 1, k = 1;
- forn(i, 0, 4) if (a[i].sc != a[i + 1].sc) k = 0;
- forn(i, 0, 4) if (a[i].fs != a[i + 1].fs - 1) f = 0;
- if (!f){
- f = 1;
- forn(i, 0, 4) if (b[i].fs != b[i + 1].fs - 1) f = 0;
- }
- if (k && f) printf("straight flush\n");
- else if (k) printf("flush\n");
- else if (f) printf("straight\n");
- else printf("unknown\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement