Submission
Status:
PPPPPPPP--PPPP----PP
Subtask/Task Score:
70/100
Score: 70
User: kavin8888
Problemset: cedt_ovb68_q03
Language: cpp
Time: 0.002 second
Submitted On: 2025-10-20 12:44:18
#include<bits/stdc++.h>
using namespace std;
#define spps1 ios::sync_with_stdio(false)
#define spps2 cin.tie(nullptr)
#define psc pair<string,char>
#define pis pair<int,string>
#define fs first
#define sc second
#define ei else if
const int n=5;
int change1(string x)
{
int ans=0;
if(x=="A")
{
ans+=14;
}
ei(x=="J")
{
ans+=11;
}
ei(x=="Q")
{
ans+=12;
}
ei(x=="K")
{
ans+=13;
}
ei(x=="10")
{
ans+=10;
}
else
{
ans+=stoi(x);
}
return ans;
}
int change2(char x)
{
int ans=0;
if(x=='S')
{
ans+=52;
}
ei(x=='H')
{
ans+=53;
}
ei(x=='C')
{
ans+=54;
}
ei(x=='D')
{
ans+=55;
}
return ans;
}
int main()
{
//chk1 => NUM chk2=>FLOWER
vector<int> chk1;
vector<int> chk2;
spps1; spps2;
vector<psc> card(n+1);
for(int i=0;i<n;i++)
{
cin>>card[i].fs;
cin>>card[i].sc;
}
for(int i=0;i<n;i++)
{
chk1.push_back(change1(card[i].fs));
chk2.push_back(change2(card[i].sc));
}
//LOOP CHECK ROYOL FLUSH & STRAIGHT FLUSH
int cntnum1=0;
int cntflower1=0;
for(int i=1;i<n;i++)
{
if(chk1[i-1]-chk1[i]==1)
{
cntnum1++;
}
if(chk2[i-1]==chk2[i])
{
cntflower1++;
}
}
//ROYOL FLUSH
if(cntnum1==4 && cntflower1==4 && chk1[0]==14)
{
cout<<"royal flush";
return 0;
}
//STRAIGHT FLUSH
if(cntnum1==4 && cntflower1==4)
{
cout<<"straight flush";
return 0;
}
//STRAIGHT
if(cntnum1==4)
{
cout<<"straight";
return 0;
}
//CHECK
int cntnum2=0;
int cntflower2=0;
//LOOP CHECK ONE PAIR TWO PAIR THREE OF KIND FOUR OF KIND FLUSH
for(int i=1;i<n;i++)
{
if(chk1[i-1]==chk1[i])
{
cntnum2++;
}
if(chk2[i-1]==chk2[i])
{
cntflower2++;
}
}
//FOUR OF KIND
if((chk1[0]==chk1[1] && chk1[1]==chk1[2] && chk1[2]==chk1[3]) || (chk1[1]==chk1[2] && chk1[2]==chk1[3] && chk1[3]==chk1[4]))
{
cout<<"four of kind";
return 0;
}
//FULLHOUSE
if((chk1[0]==chk1[1] && chk1[1]==chk1[2] && chk1[3]==chk1[4]) || (chk1[0]==chk1[1] && chk1[2]==chk1[3] && chk1[3]==chk1[4]))
{
cout<<"fullhouse";
return 0;
}
//FLUSH
if(cntflower2==4)
{
cout<<"flush";
return 0;
}
//THREE OF KIND
if((chk1[0]==chk1[1] && chk1[1]==chk1[2]) || (chk1[1]==chk1[2] && chk1[2]==chk1[3]) || (chk1[2]==chk1[3] && chk1[3]==chk1[4]))
{
cout<<"three of kind";
return 0;
}
//TWO PAIR
if(cntnum2>=2)
{
cout<<"two pair";
return 0;
}
//ONE PAIR
if(cntnum2==1)
{
cout<<"pair";
return 0;
}
//HIGH CARD
else
{
cout<<"high card";
return 0;
}
}