アットウィキロゴ

xcd

class pro{

String str,ph,ph2,ph1;
int strlong;
double[][] v=new double[500][10];
String[][] word=new String[500][10];
int wordnumber;
int s,sx,t,tx;
double v1,maxv;

public static void main(String args[]){
pro test=new pro();
}

pro(){

str="インターネット通販";

strlong=str.length();


for(s=1;s<strlong+1;s++){
for(sx=1;sx<10;sx++){
if(s+sx-1<strlong+1)word[s][sx]=str.substring(s-1,s+sx-1);
}
}

v[1][1]=f(word[1][1]);
v[2][1]=g(word[2][1],word[1][1])+v[1][1];
v[2][2]=f(word[1][2]);

for(s=3;s<strlong+1;s++){
for(sx=1;sx<s;sx++){
t=s-sx;
maxv=-999;
for(tx=1;tx<t+1;tx++){
v1=g(word[s-sx+1][sx],word[t-tx+1][tx])+v[t][tx];
if(v1>maxv)maxv=v1;
}
v1=f(word[1][s]);
if(v1>maxv)maxv=v1;
v[s][sx]=maxv;
}
v[s][s]=f(word[1][s]);
}




}

double g(String ph1,String ph2){
double g1;
g1=0.5;
return g1;
}

double f(String ph){
double f1;
f1=0.5;
return f1;
}
}
最終更新:2011年05月28日 15:19