?????????????????????????????????????????????????????????????2??????????????????A??????2??B??????3??C??????5??????????????????????????????????????????????????????????????????????
???????——????????????????????????????????????????????????????в?????????????????????????????????????????????????????????????
?????·??????£?
????1.????С??26??????????????'A'??'Z'?????
????2.???????????????????????????????????
????3.??????????????ж??????????????е???????????????????
????4.????????
?????????????????????????????臨????O(m+n)????臨?????????O(n)
package contcurrentandalgorithm;
/**
*
* @author Administrator
* zyyjiao@mail.ustc.edu.cn
*/
public class SushuStringFind {
public static void main(String[] args) {
int primeNumber[] = {2?? 3?? 5?? 7?? 11?? 13?? 17?? 19?? 23?? 29?? 31?? 37?? 41?? 43?? 47?? 53?? 59??
61?? 67?? 71?? 73?? 79?? 83?? 89?? 97?? 101};
String strOne = "ABCDEFGHLMNOPQRS";
String strTwo = "ABCDEFGHL";
// ????????????????
int product = 1;   //????????????????????????
// ?????????????????????????????????
for (int i = 0; i < strOne.length(); i++) {
int index = strOne.charAt(i) - 'A';
product = product * primeNumber[index];
}
// ???????????
for (int j = 0; j < strTwo.length(); j++) {
int index = strTwo.charAt(j) - 'A';
// ??????????0?????????????????е?????????????
if (product % primeNumber[index] != 0) {
break;
}
if (strTwo.length() == j) //cout << "true" << endl;
{
System.out.println("true");
} else //cout << "false" << endl;
{
System.out.println("false");
}
}
}
}