zoukankan      html  css  js  c++  java
  • xdoj 1044---炸红花 (话说 小时候经常玩这个被虐。。。。qwq)

     1 // 我真的好笨  只会枚举 话说那个ac的370b到底是怎么做的 /(ㄒoㄒ)/~~
     2 #include <iostream>
     3 #include <algorithm>
     4 using namespace std;
     5 struct T{
     6     int type;// 核♥  分类排序
     7     int x;
     8     friend bool operator < (const T& a,const T& b) {
     9         if (a.type==b.type) return (a.x<b.x);
    10         else               return a.type>b.type;
    11     }
    12 };
    13 T t[1000];
    14 int main ()
    15 {
    16     int n=0;
    17     for (int i=1;i<=9;i++)
    18         for (int j=i;j<=9;j++)
    19             for (int k=j;k<=9;k++) {
    20                 t[++n].x=k*100+j*10+i;
    21                 if (i==j&&j==k) t[n].type=1;
    22                 else if (i+2==k&&i+1==j) t[n].type=2;
    23                 else if (i==j) {
    24                     t[n].type=3;
    25                     t[n].x=i*100+j*10+k;// 如果是对子 先比较对子 然后再比较单张
    26                 }
    27                 else if (j==k)  t[n].type=3;
    28                 else            t[n].type=4;
    29             }
    30    sort(t+1,t+1+n);
    31    int T; cin>>T;
    32    int a[5];
    33    while (T--) {
    34         for (int i=1;i<=3;i++) cin>>a[i];  sort(a+1,a+4);
    35         int x=a[3]*100+a[2]*10+a[1];
    36         if (a[1]==a[2]&&a[2]!=a[3])  x=a[1]*100+a[2]*10+a[3];
    37         int i;
    38         for (i=1;i<=n;i++) {if (x==t[i].x) break;}
    39         if (a[3]==a[2]&&a[2]==a[1])         cout<<n-i+1<<endl;
    40         else if (x==532)                    cout<<n-i-9<<endl;
    41         else if (a[3]==a[2]||a[2]==a[1])    cout<<n-i-1<<endl;// 因为牌最多有四张 对子的情况去掉豹子的那一种情况;
    42         else                                cout<<n-i<<endl;
    43    }
    44    return 0;
    45 }
    抓住青春的尾巴。。。
  • 相关阅读:
    bootstrap treevie只展开一个节点,关闭其他节点
    Java后端校验-使用hibernate-validator校验JavaBean
    js生成Excel文件
    Databus&canal对比
    KVM安装配置笔记
    机器学习之数学基础一导数
    机器学习-线性回归
    机器学习之数学基础一统计
    Leader与Boss,技术leader与管理者
    php递归获取无限分类菜单
  • 原文地址:https://www.cnblogs.com/xidian-mao/p/8469152.html
Copyright © 2011-2022 走看看