package thx;
import tool.*;
public class pro {
int s,datanumber;
String[] data=new String[15000];
String[][] t=new String[15000][52];
int[][] p=new int[15000][52];
int[] v=new int[15000];
int[] rank=new int[7000];
int dicnumber=0;
String[] dic=new String[50000];
public static void main(String[] args) {
pro r=new pro();
}
pro(){
readfile sub2=new readfile();
sub2.makedata("title.csv","UTF-8");
data=sub2.data;
datanumber=sub2.datanumber;
int sx;
for(s=2;s<datanumber+1;s++){
String[] x=data[s].split(",");
for(sx=0;sx<50;sx++){
t[s-1][sx+1]=x[sx];
}
}
int n;
for(s=1;s<datanumber;s++){
for(n=1;n<51;n++){
int h=0;
for(sx=1;sx<dicnumber+1;sx++){
if(t[s][n].equals(dic[sx]))h=100;
}
if(h<50)dicnumber=dicnumber+1;
if(h<50)dic[dicnumber]=t[s][n];
}
}
System.out.println(dicnumber);
readfile sub3=new readfile();
sub3.makedata("salex.csv","UTF-8");
data=sub3.data;
datanumber=sub3.datanumber;
for(s=2;s<datanumber+1;s++){
String[] x=data[s].split(",");
for(sx=0;sx<50;sx++){
p[s-1][sx+1]=numx(x[sx]);
}
}
for(s=1;s<datanumber;s++){
for(n=1;n<51;n++){
int sxs=0;
for(sx=1;sx<dicnumber+1;sx++){
if(t[s][n].equals(dic[sx]))sxs=sx;
}
v[sxs]=v[sxs]+p[s][n];
}
}
ranking();
for(s=1;s<101;s++){
sx=rank[s];
System.out.println(dic[sx]+","+v[sx]);
}
}
void ranking(){
int r,s,sx,h;
int[] ch=new int[8000];
double maxu;
for (r = 1; r < dicnumber + 1; r++) {
sx = 0;
maxu = -999999;
for (s = 1; s < dicnumber + 1; s++) {
h = 0;
if (v[s] > maxu) h = h + 1;
if (ch[s] < 50) h = h + 1;
if (h == 2) maxu = v[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;
}
}
最終更新:2016年07月07日 17:32