アットウィキロゴ

java jum

import java.io.*;

class rank{

int s,sx,sxs,dicnumber,datanumber;
String[] data=new String[50000];  
String[] dic=new String[50000];    
int[][] nword=new int[250][50000];
int[] wordnumber=new int[250];
int[] num=new int[50000];
int[] rank=new int[1000];
int[] ch=new int[50000];
int maxn;
int n,nx,h,r;
String file;

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

rank(){

readfile("dic.txt");

for(s=1;s<datanumber+1;s++){
String[] y=data[s].split(",");
if(y.length>1)dic[s]=y[1];
}

dicnumber=datanumber;


for(n=1;n<215;n++){

file="adata/";
file=file+n;
file=file+".txt";

readfile(file);

wordnumber[n]=datanumber;

for(s=1;s<datanumber+1;s++){
String[] x=data[s].split(",");
nword[n][s]=Integer.parseInt(x[1]);
}

}


for(n=1;n<215;n++){
nx=wordnumber[n];
for(s=1;s<nx+1;s++){
sx=nword[n][s];
num[sx]=num[sx]+1;
}
}


System.out.println(num[1]);


for(r=1;r<1000;r++){
sx=0;
maxn=0;
for(s=1;s<dicnumber+1;s++){
h=0;
if(num[s]>maxn)h=h+1;
if(ch[s]<50)h=h+1;
if(h==2)sx=s;
if(h==2)maxn=num[s];
}
ch[sx]=100;
rank[r]=sx;
}


for(s=1;s<100;s++){
sx=rank[s];
System.out.println(dic[sx]);
}







}


void readfile(String file){

String str;
BufferedReader br;
int s;
s=0;

try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(file),"SJIS"));  
while((str = br.readLine()) != null) {  
s=s+1;
data[s]=str;  
}
br.close();
} catch (IOException e) {System.out.println(e);}
datanumber=s;

}



}
最終更新:2011年06月07日 23:55