Advertisement
PikMike

Untitled

Dec 26th, 2015
493
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.51 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. #define pb push_back
  4. #define mp make_pair
  5. #define sz size
  6. #define ll long long
  7. #define ld long double
  8. #define fs first
  9. #define sc second
  10. #define forn(i, f, t) for(int i = f; i < t; i++)
  11. #define all(x) (x).begin(), (x).end()
  12. #define ins insert
  13.  
  14. const int INF = 2147483647;
  15. const int MOD = 1000000007;
  16. const ll INF64 = 9223372036854775807;
  17. const ld EPS = 1e-7;
  18.  
  19. using namespace std;
  20.  
  21.  
  22. int main(){
  23.     pair<int, int> a[5], b[5];
  24.     string t;
  25.     forn(i, 0, 5){
  26.         cin >> t;
  27.         if (t[0] == 'T') a[i].fs = 10, b[i].fs = -3;
  28.         else if (t[0] == 'J') a[i].fs = 11, b[i].fs = -2;
  29.         else if (t[0] == 'Q') a[i].fs = 12, b[i].fs = -1;
  30.         else if (t[0] == 'K') a[i].fs = 13, b[i].fs = 0;
  31.         else if (t[0] == 'A') a[i].fs = 14, b[i].fs = 1;
  32.         else a[i].fs = t[0] - '0', b[i].fs = t[0] - '0';
  33.         if (t[1] == 'H') a[i].sc = 0, b[i].sc = 0;
  34.         else if (t[1] == 'D') a[i].sc = 1, b[i].sc = 1;
  35.         else if (t[1] == 'S') a[i].sc = 2, b[i].sc = 2;
  36.         else if (t[1] == 'C') a[i].sc = 3, b[i].sc = 3;
  37.     }
  38.     sort(a, a + 5); sort(b, b + 5);
  39.     bool f = 1, k = 1;
  40.     forn(i, 0, 4) if (a[i].sc != a[i + 1].sc) k = 0;
  41.     forn(i, 0, 4) if (a[i].fs != a[i + 1].fs - 1) f = 0;
  42.     if (!f){
  43.         f = 1;
  44.         forn(i, 0, 4) if (b[i].fs != b[i + 1].fs - 1) f = 0;
  45.     }
  46.     if (k && f) printf("straight flush\n");
  47.     else if (k) printf("flush\n");
  48.     else if (f) printf("straight\n");
  49.     else printf("unknown\n");
  50.     return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement