import java.io.*;
class nrank{
String[] word=new String[50000];
String[] dic=new String[50000];
int[] mx1=new int[50000];
int[] mx2=new int[50000];
int[] nword=new int[50000];
int[] number=new int[50000];
int[] rank=new int[50000];
String file;
int xmlnumber;
int n,nx,nxs,h,s;
int m1,m2,m3,d;
String[] data=new String[50000];
int datanumber,dicnumber;
int n1;
public static void main(String args[]){
nrank test=new nrank();
}
nrank(){
readfile("dic.txt");
dicnumber=datanumber;
for (s=1;s<dicnumber+1;s++){
String[] x=data[s].split(",");
dic[s]=x[1];
}
for(s=1;s<dicnumber+1;s++){
number[s]=0;
}
for(m1=13;m1<20;m1++){
if(m1==13)m3=35;
if(m1==14)m3=42;
if(m1==15)m3=30;
if(m1==16)m3=35;
if(m1==17)m3=31;
if(m1==18)m3=31;
if(m1==19)m3=10;
for(m2=1;m2<m3+1;m2++){
d=100*m1+m2;
file="ndata/";
file=file+d;
file=file+".txt";
readfile(file);
for (n=1;n<datanumber+1;n++){
String[] x=data[n].split(",");
mx1[n]=Integer.parseInt(x[0]);
mx2[n]=Integer.parseInt(x[1]);
nword[n]=Integer.parseInt(x[2]);
}
for (n=1;n<datanumber+1;n++){
s=nword[n];
number[s]=number[s]+1;
}
}
}
ranking();
for (n=200;n<400;n++){
n1=rank[n];
System.out.print(n);
System.out.print(",");
System.out.print(dic[n1]);
System.out.print(",");
System.out.println(number[n1]);
}
}
void ranking(){
int[] b=new int[50000];
int maxn,n,nx,bx;
for(n=1;n<dicnumber+1;n++){
b[n]=number[n];
}
for(nx=1;nx<1000;nx++){
maxn=0;
bx=0;
for(n=1;n<dicnumber+1;n++){
if(b[n]>maxn)bx=n;
if(b[n]>maxn)maxn=b[n];
}
b[bx]=0;
rank[nx]=bx;
}
}
void readfile(String file){
String str;
BufferedReader br;
n=0;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(file),"SJIS"));
while((str = br.readLine()) != null) {
n=n+1;
data[n]=str;
}
br.close();
} catch (IOException e) {System.out.println(e);}
datanumber=n;
}
}
最終更新:2011年05月16日 01:13