アットウィキロゴ

ko900

package delya;
 
 
import tool.*; 
import java.io.File;
 
public class pro {
 
    int s,datanumber;
String[] data=new String[40000];
String[] link=new String[40000];
  String[] name=new String[40000];
String[] music=new String[40000];
int[][] point=new int[3000][200]; 
int[] count=new int[200]; 
int[] countx=new int[200];
int don,donx;
double[] rate=new double[50];
double[] r=new double[50];
double[] r2=new double[5000];
int[] t=new int[20000];
 
    public static void main(String[] args) {
       pro t=new pro();
    }
    pro(){
 
 
        String urlx="tv.csv";
 
       readfile sub2=new readfile();
        sub2.makedata(urlx,"UTF-8");
        data=sub2.data;
        datanumber=sub2.datanumber;
 
        String date="artist-introduction-pic";
 
        int number=0;
 
        String str="";
        int sx=0;
  for(s=2;s<datanumber+1;s++){
  String[] x=data[s].split(",");  
 name[s-1]=x[0];
 for(sx=1;sx<x.length;sx++){
 if(x[sx].indexOf("○")>-1)point[s-1][sx]=100;      
 }
 number=x.length-1;
  }
 
  int s1=0;
  int s2=0;
  int tx=0;   
 
  for(s=1;s<datanumber;s++){
  for(sx=2;sx<number+1;sx++){
 s1=0;     
 for(tx=1;tx<sx;tx++){
 if(point[s][tx]>50)s1=tx;      
 }   
 s2=0;     
 for(tx=1;tx<sx;tx++){
 if(point[s][tx]<50)s2=tx;      
 }   
 int t1=s2-s1;
 int h=0;
 if(s1>0)h=h+1;
 if(t1>0)h=h+1;
 if(point[s][sx]>50)h=h+1;
 if(h==3)count[t1]=count[t1]+1;
 h=0;
 if(s1>0)h=h+1;
 if(t1>0)h=h+1;
 if(point[s][sx]<50)h=h+1;
  if(h==3)countx[t1]=countx[t1]+1;
 
  }    
  }
 
 for(s=1;s<datanumber;s++){
  for(sx=2;sx<number+1;sx++){
int h=0;
 if(point[s][sx-1]>60)h=h+1;
 if(point[s][sx]>60)h=h+1;
 if(h==2)count[0]=count[0]+1;
 h=0;
 if(point[s][sx-1]>60)h=h+1;
 if(point[s][sx]<60)h=h+1;
 if(h==2)countx[0]=countx[0]+1;
  }    
  }
 
 
     for(s=1;s<41;s++){   
     rate[s]=(double)count[s]/(count[s]+countx[s]);      
    }
 
     r[0]=1;    
    for(s=1;s<41;s++){   
    double p1=1;
    for(sx=s+1;sx<41;sx++){
    p1=p1*(1-rate[sx]);
    } 
    r[s]=p1;
    }
 
   for(s=1;s<datanumber;s++){      
  s1=0;
for(sx=1;sx<number+1;sx++){
if(point[s][sx]>60)s1=sx;
}      
int t1=number-s1;
if(t1>40)t1=40;
r2[s]=r[t1];
 
}      
 
for(s=1;s<datanumber;s++){      
s1=0;
for(sx=1;sx<number+1;sx++){
if(point[s][sx]>60)s1=sx;
}    
s2=0;
for(sx=1;sx<number+1;sx++){
if(point[s][number+1-sx]>60)s2=number+1-sx;
}    
t[s]=s1-s2;        
 
 
}         
 
for(s=0;s<40;s++){    
double p1=0;    
double p2=0;
for(sx=1;sx<datanumber;sx++){
p1=p1+(1-r2[sx]);
if(t[sx]>s-1)p2=p2+(1-r2[sx]);
}
double p3=p2/p1;
 
System.out.println(s+","+p3);
 
}
 
 
 
 
 
 
    }
    String change(String str){
 
        int n;
        for(n=1;n<11;n++){
        str=rev(str);    
        }
 
        str=str.replace(" ","");
 
        return str;
    }
 
 String rev(String str){
 
        if(str==null)str="";
 
        int p1=str.indexOf("<");
        int p2=str.indexOf(">",p1);
        String strx="";
        if(p2>-1)strx=str.substring(p1,p2+1);
        str=str.replace(strx,"");
 
        return str;
    }    
 
 
}
 
最終更新:2016年09月09日 11:44