5.01 - if (s.Length <= 3){
return "short";
}
if (s.Length >= 4 && s.Length <= 7){
return "average";
}
if(s.Length >= 8 && s.Length <= 14){
return "long";
}
return "super long";
5.02 - thx
if (i % 1111 == 0) return "fancy year";
return "not a fancy year";
5.04 - if (y > 0 && x < 0){
return (x-y) - 2*(x-y);
}
if (x > 0 && y < 0){
return (x-y);
}
if ((x+y) < 0){
return (x+y) - 2*(x+y);
}
return x + y;
5.05 - return (j == i*i)
5.4 - return Math.Abs(x)+Math.Abs(y);
ReplyDelete5.2
ReplyDeletepublic class Program {
public static String Puzzle(int i) {
if ((i%1111) == 0){
return "fancy year";
}
else{
return "not a fancy year";
}
}
}
5. 3
ReplyDeletepublic class Program {
public static Boolean Puzzle(int a, int b, int c) {
if(a*a + b*b == c*c ||
a*a + c*c == b*b ||
c*c + b*b == a*a)
return true;
else
return false;
}
}