HZF爱斗牛

hzf 最近迷上 QQ 游戏欢乐斗牛。

斗牛的规则如下,游戏开始的时候,每位玩家发 555 张扑克牌,每张牌都是 A-K 中的一张牌(111 表示 A,2−102-10210 表示对应的牌,111111-J,121212-Q,131313-K)。每张牌都有一个点数,1−101-10110 分别对应其点数,11−1311-131113 对应点数 101010。牌型分为以下 555 种情况,牌型的优先级按照给定从上到下。

  1. 四炸——555 张牌中有 444 张牌相同 ,优先级最高。
  2. 五小牛——即五张牌点数都小于 555,且 555 张牌的点总数和小于或等于 101010,优先级次之。
  3. 牛牛——其中 333 张牌的点数和是 101010 的整数倍,另外 222 张牌的点数和是 101010 的整数倍。
  4. x(x=1,2,3…9)x(x=1,2,3\ldots 9)x(x=1,2,39)——其中 333 张牌的点数和是 101010 的整数倍,另外 222 张牌的点数和对 101010 取模为 xxx。
  5. 以上情况都不是,就是无牛。

hzf 要根据自己的牌型来决定自己的下注的倍数,但是 hzf 总是不能看出他的牌型,你能写一个程序帮助他吗。

输入格式

一行输入 555 个空格隔开的整数。

输出格式

若牌型为四炸,输出一行quadra bomb orz

若为五小牛,输出一行penta calf

若为牛牛,输出一行you can you up

若为牛 x,输出一行too young too simple:calf x

若为无牛,输出一行gg.

样例输入1
10 10 10 1 1
样例输出1
too young too simple:calf 2
样例输入2
10 10 10 10 9
样例输出2
quadra bomb orz
package 计蒜客;

import java.util.Scanner;

public class HZF爱斗牛 {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner scan=new Scanner(System.in);
        String str=scan.nextLine();
        String[] strs=str.split(" ");
        int a=change(strs[0]);
        int b=change(strs[1]);
        int c=change(strs[2]);
        int d=change(strs[3]);
        int e=change(strs[4]);
        if(isFirst(a,b,c,d,e)){
            System.out.println("quadra bomb orz");
        }else if(isSecond(a,b,c,d,e)){
            System.out.println("penta calf");
        }else if(isThird(a,b,c,d,e)){
            System.out.println("you can you up");
        }else if(isFourth(a,b,c,d,e)!=0){
            System.out.println("too young too simple:calf "+isFourth(a,b,c,d,e));
        }else{
            System.out.println("gg");
        }
    }
    public static int change(String str){
        if(str.equals("A")){
            return 1;
        }else if(str.equals("11")){
            return 10;
        }else if(str.equals("12")){
            return 10;
        }else if(str.equals("13")){
            return 10;
        }else{
            return Integer.parseInt(str);
        }
    }
    public static boolean isFirst(int a,int b,int c,int d,int e){
        if(a==b&&b==c&&c==d){
            return true;
        }
        if(a==b&&b==c&&c==e){
            return true;
        }
        if(a==b&&b==d&&d==e){
            return true;
        }
        if(a==c&&c==d&&d==e){
            return true;
        }
        if(b==c&&c==d&&d==e){
            return true;
        }
        return false;
    }
    public static boolean isSecond(int a,int b,int c,int d,int e){
        if(a<5&&b<5&&c<5&&d<5&&e<5&&a+b+c+d+e<=10){
            return true;
        }
        return false;
    }
    public static boolean isThird(int a,int b,int c,int d,int e){
        if((a+b+c)%10==0&&(d+e)%10==0){
            return true;
        }
        if((a+b+d)%10==0&&(c+e)%10==0){
            return true;
        }
        if((a+b+e)%10==0&&(c+d)%10==0){
            return true;
        }
        if((a+c+d)%10==0&&(b+e)%10==0){
            return true;
        }
        if((a+c+e)%10==0&&(b+d)%10==0){
            return true;
        }
        
        if((a+d+e)%10==0&&(b+c)%10==0){
            return true;
        }
        if((b+c+d)%10==0&&(a+e)%10==0){
            return true;
        }
        if((b+c+e)%10==0&&(a+d)%10==0){
            return true;
        }
        if((b+d+e)%10==0&&(a+c)%10==0){
            return true;
        }
        if((c+d+e)%10==0&&(a+b)%10==0){
            return true;
        }
        return false;
    }
    public static int isFourth(int a,int b,int c,int d,int e){
        int yuShu;
        if((a+b+c)%10==0){
            yuShu=(d+e)%10;
            return yuShu;
        }
        if((a+b+d)%10==0){
            yuShu=(c+e)%10;
            return yuShu;
        }
        if((a+b+e)%10==0){
            yuShu=(c+d)%10;
            return yuShu;
        }
        if((a+c+d)%10==0){
            yuShu=(b+e)%10;
            return yuShu;
        }
        if((a+c+e)%10==0){
            yuShu=(b+d)%10;
            return yuShu;
        }
        
        if((a+d+e)%10==0){
            yuShu=(b+c)%10;
            return yuShu;
        }
        if((b+c+d)%10==0){
            yuShu=(a+e)%10;
            return yuShu;
        }
        if((b+c+e)%10==0){
            yuShu=(a+d)%10;
            return yuShu;
        }
        if((b+d+e)%10==0){
            yuShu=(a+c)%10;
            return yuShu;
        }
        if((c+d+e)%10==0){
            yuShu=(a+b)%10;
            return yuShu;
        }
        return 0;
    }
}

 

转载于:https://www.cnblogs.com/henuLiGang/p/8552399.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值