- 注册
- 2002-10-12
- 消息
- 47,114
- 荣誉分数
- 2,376
- 声望点数
- 393
有这么一个程序,如何才能推算出来正确的未知值呢
public class Program{
private static String hash(String s)
{
String s1 = "";
int i = 0;
for(int j = 0; j < s.length(); j++)
{
i = (s.charAt(j) * (j + i + 3) + 17) % 676;
s1 = s1 + "" + (char)(i % 26 + 65);
s1 = s1 + "" + (char)(i / 26 + 65);
}
return s1;
}
public static void main(String args[]){
String s = "未知值";
s = hash(s);
if(s.compareTo("CMZQHWEOTJKMPX") == 0)
{
System.out.println("correct!");
} else
{
System.out.println("wrong");
}
}
}
public class Program{
private static String hash(String s)
{
String s1 = "";
int i = 0;
for(int j = 0; j < s.length(); j++)
{
i = (s.charAt(j) * (j + i + 3) + 17) % 676;
s1 = s1 + "" + (char)(i % 26 + 65);
s1 = s1 + "" + (char)(i / 26 + 65);
}
return s1;
}
public static void main(String args[]){
String s = "未知值";
s = hash(s);
if(s.compareTo("CMZQHWEOTJKMPX") == 0)
{
System.out.println("correct!");
} else
{
System.out.println("wrong");
}
}
}