转载请注明来自http://blog.csdn.net/wunaiyunaiwu
05.01 多测几组数值就能看出规律了
public class Program {
public static String Puzzle(String s) {
int len = s.length();
return len>14?"super long":(len>7?"long":(len>3?"average":"short"));
}
}
05.02
public class Program {
public static String Puzzle(int i) {
return i%1111==0?"fancy year":"not a fancy year";
}
}
05.03 请忽略变量命名
public class Program {
public static Boolean Puzzle(int a, int b, int c) {
int aa = a*a, bb = b*b, cc = c*c;
return (aa==bb+cc)||(bb==aa+cc)||(cc==aa+bb);
}
}
05.04
public class Program {
public static int Puzzle(int x, int y) {
return Math.abs(x)+Math.abs(y);
}
}
05.05
public class Program {
public static Boolean Puzzle(int i, int j) {
return ((int)i*i)==j?true:false;
}
}