HZF爱斗牛 - henu小白 - 博客园
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;
}
}
评论