package pen2;
import tool.readfile;
public class pro {
int s,datanumber;
String[] data=new String[5000];
String[] dic=new String[50000];
String[] artist=new String[50000];
int number;
int[] point=new int[50000];
int[] v=new int[50000];
int dicnumber=0;
int[] rank=new int[50000];
public static void main(String[] args) {
pro u=new pro();
}
pro(){
readfile sub2=new readfile();
sub2.makedata("data.csv","UTF-8");
data=sub2.data;
datanumber=sub2.datanumber;
for(s=2;s<datanumber+1;s++){
String[] x=data[s].split(",");
artist[s-1]=x[9];
point[s-1]=num_int(x[5]);
}
int sx;
for(s=1;s<datanumber;s++){
int h=0;
for(sx=1;sx<dicnumber+1;sx++){
if(artist[s].equals(dic[sx]))h=100;
}
if(h<50)dicnumber=dicnumber+1;
if(h<50)dic[dicnumber]=artist[s];
}
for(s=1;s<datanumber;s++){
int h=0;
for(sx=1;sx<dicnumber+1;sx++){
if(artist[s].equals(dic[sx]))v[sx]=v[sx]+point[s];
}
}
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[80000];
double maxu;
for (r = 1; r < 101; 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 num_int(String str){
int nx;
nx=0;
try{
nx=Integer.parseInt(str);
}catch (Exception e) {}
return nx;
}
}
最終更新:2017年07月05日 19:57