package sp;
import tool.*;
public class pro {
int s,datanumber;
String[] data=new String[50000];
String[] code=new String[50000];
String[] name=new String[50000];
String[] namex=new String[50000];
String[] dic=new String[50000];
int[] point=new int[50000];
int[] v=new int[50000];
int[] rank=new int[50000];
int sx,dicnumber=0;
public static void main(String[] args) {
pro te=new pro();
}
pro(){
readfile sub52=new readfile();
sub52.makedata("data.csv","UTF-8");
data=sub52.data;
datanumber=sub52.datanumber;
for(s=1;s<datanumber+1;s++){
String[] x=data[s].split(",");
code[s]=x[2];
if(code[s].length()<1)code[s]=x[1];
name[s]=x[1];
point[s]=numx(x[4]);
}
dic[0]="△";
for(s=1;s<datanumber+1;s++){
if(code[s].length()<1)code[s]="△";
int h=0;
for(sx=0;sx<dicnumber+1;sx++){
if(code[s].equals(dic[sx]))h=100;
}
if(h<50)dicnumber=dicnumber+1;
if(h<50)dic[dicnumber]=code[s];
if(h<50)namex[dicnumber]=name[s];
}
for(s=1;s<datanumber+1;s++){
for(sx=0;sx<dicnumber+1;sx++){
if(code[s].equals(dic[sx]))v[sx]=v[sx]+point[s];
}
}
ranking();
for(s=1;s<dicnumber+1;s++){
sx=rank[s];
System.out.println(namex[sx]+","+dic[sx]+","+v[sx]);
}
}
void ranking(){
int r,s,sx,h;
int[] ch=new int[5000];
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月18日 12:30