アットウィキロゴ

で0098

package base5;
 
import tool.*;
import java.io.*;
 
public class pro {
 
     String[] subdata=new String[50000];
  int s,datanumber;
  String[] data=new String[50];
     String[] pos=new String[50];
   String[] name=new String[50];
     int[] point=new int[200];
 int[] count=new int[500];
  int[] countx=new int[500];
 int[] de=new int[500];
 int[] rank=new int[500];
    public static void main(String[] args) {
        pro t=new pro();
    }
    pro(){
 
        int tx=0;
        int tr;
 for(tr=1;tr<484;tr++){
 
     readfile sub7=new readfile();
        sub7.makedata("visit_pppp/"+tr+".txt","UTF-8");
        data=sub7.data;
        datanumber=sub7.datanumber; 
 
        for(s=1;s<datanumber+1;s++){
 String[] x=data[s].split(",");
 int n=numx(x[1]);
 count[s]=n;
 
        }
 
         for(s=1;s<11;s++){
          de[s]=0;   
         }
  for(s=1;s<datanumber+1;s++){
  int n=count[s];
  de[n]=de[n]+1;
  countx[s]=de[n];
 
        }  
 
       for(s=1;s<datanumber+1;s++){  
  point[s]=100*countx[s]+count[s];
 
 }
 
 ranking(); 
 
    for(s=1;s<datanumber+1;s++){  
  int sx=rank[datanumber-s+1];
 tx=tx+1;
 subdata[tx]=""+tr+","+data[sx];
 
 }
 
 
 
 
 }
 
 
 datanumber=tx;
 
 writecsv("ren.csv");
 
    }
 
 
    void ranking(){ 
int r,s,sx,h; 
int[] ch=new int[2001];
double maxu;
 
for(r=1;r<datanumber+1;r++){ 
sx=0; 
maxu=-999999; 
for(s=1;s<datanumber+1;s++){ 
h=0; 
if(point[s]>maxu)h=h+1; 
if(ch[s]<50)h=h+1; 
if(h==2)maxu=point[s]; 
if(h==2)sx=s; 
}
rank[r]=sx; 
ch[sx]=100; 
}
 
 
}
 
 
    int numx(String str){
 
    int nx;
 
    nx=0;
 
 try{
 
    nx=Integer.parseInt(str);
 
 }catch (Exception e) {}
 
 return nx;
 
 
 
} 
 
    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;
    }    
 
       void writecsv(String file){ 
 
    int s,sx;
 
try{ 
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file))); 
 
for(s=1;s<datanumber+1;s++){  
pw.println(subdata[s]);
}
 
 
System.out.println("ファイルに書きこみました。"); 
pw.close(); 
} catch(IOException ep){ System.out.println("入出力エラーです。"); } 
 
 
} 
 
 
 
}
最終更新:2016年10月08日 03:38