#include<bits/stdc++.h>
using namespace std;
int cnt[11];
struct card{
int a;
int b;
bool operator<(card c){
if(a<c.a) return true;
if(a>c.a) return false;
if(b<c.b) return true;
if(b>c.b) return false;
}
bool operator==(card c){
if(a==c.a&&b==c.b) return true;
return false;
}
card(int aa,int bb){
a=aa;b=bb;
}
card(){};
};
vector<card> hold;
bool bomb(){
//判断炸弹
if(hold[0].a==hold[1].a){
for(int i=0;i<3;i++){
if(hold[i+1].a!=hold[i].a) return false;
}
}
else{
for(int i=1;i<4;i++){
if(hold[i+1].a!=hold[i].a) return false;
}
}
return true;
}
bool three_two(){
//判断三带二
//2 2 2 3 3
//2 2 3 3 3
if(hold[1].a!=hold[2].a){
if(hold[0].a!=hold[1].a) return false;
if(hold[2].a!=hold[3].a) return false;
if(hold[3].a!=hold[4].a) return false;
return true;
}
else{
if(hold[0].a!=hold[1].a) return false;
if(hold[3].a!=hold[4].a) return false;
return true;
}
return false;
}
bool sameb(){
//判断同花
for(int i=0;i<4;i++){
if(hold[i+1].b!=hold[i].b) return false;
}
return true;
}
bool straight(){
//判断顺子
for(int i=0;i<4;i++){
if(hold[i+1].a!=hold[i].a+1) return false;
}
return true;
}
bool sameb_straight(){
//判断同花顺
if(sameb()&&straight()) return true;
return false;
}
bool three(){
//判断三条
if(hold[0].a==hold[1].a){
if(hold[1].a==hold[2].a) return true;
}
if(hold[1].a==hold[2].a){
if(hold[2].a==hold[3].a) return true;
}
if(hold[2].a==hold[3].a){
if(hold[3].a==hold[4].a) return true;
}
return false;
}
bool double_two(){
//判断两对
if(hold[0].a==hold[1].a){
if(hold[2].a==hold[3].a) return true;
}
if(hold[1].a==hold[2].a){
if(hold[3].a==hold[4].a) return true;
}
if(hold[0].a==hold[1].a){
if(hold[3].a==hold[4].a) return true;
}
return false;
}
bool two(){
//判断一对
if(hold[0].a==hold[1].a) return true;
if(hold[1].a==hold[2].a) return true;
if(hold[2].a==hold[3].a) return true;
if(hold[3].a==hold[4].a) return true;
return false;
}
void valirify(){
if(sameb_straight()){
cnt[0]++;
return;
}
if(bomb()){
cnt[1]++;
return;
}
if(three_two()){
cnt[2]++;
return;
}
if(sameb()){
cnt[3]++;
return;
}
if(straight()){
cnt[4]++;
return;
}
if(three()){
cnt[5]++;
return;
}if(double_two()){
cnt[6]++;
return;
}
if(two()){
cnt[7]++;
return;
}
cnt[8]++;
}
card pool[110];
int main(){
memset(cnt,0,sizeof(cnt));
int anum,bnum;
int step=0;
cin>>anum>>bnum;
int sum=anum*bnum;
card start1,start2;
cin>>start1.a>>start1.b>>start2.a>>start2.b;
hold.push_back(start1);
hold.push_back(start2);
for(int i=0;i<anum;i++){
for(int j=0;j<bnum;j++){
if((i==start1.a&&j==start1.b)||(i==start2.a&&j==start2.b)) continue;
card temp(i,j);
pool[step++]=temp;
}
}
for(int i=0;i<sum-2;i++){
hold.push_back(pool[i]);
for(int j=0;j<i;j++){
hold.push_back(pool[j]);
for(int k=0;k<j;k++){
hold.push_back(pool[k]);
sort(hold.begin(),hold.end());
valirify();
for(auto it=hold.begin();it!=hold.end();it++){
if(*it==pool[k]){
hold.erase(it);
break;
}
}
}
for(auto it=hold.begin();it!=hold.end();it++){
if(*it==pool[j]){
hold.erase(it);
break;
}
}
}
for(auto it=hold.begin();it!=hold.end();it++){
if(*it==pool[i]){
hold.erase(it);
break;
}
}
}
for(int i=0;i<9;i++) cout<<cnt[i]<<' ';
return 0;
}
山东大学程序设计思维-每月复杂模拟1-飞飞的赌神修炼手册
于 2024-03-22 17:53:10 首次发布