package p4;
import java.io.*;
public class pro {
int s,datanumber;
String[] data=new String[50000];
String[] name=new String[50000];
int[] point=new int[50000];
String[] dic=new String[50000];
int[][] v=new int[1000][1000];
int number;
int[][] th=new int[13][1000];
public static void main(String[] args) {
pro t=new pro();
}
pro(){
readx("base.csv");
for(s=2;s<datanumber+1;s++){
String[] x=data[s].split(",");
name[s]=x[3];
point[s]=numx(x[0]);
number=point[s];
}
int sx,h,dicnumber;
dicnumber=0;
for(s=2;s<datanumber+1;s++){
h=0;
for(sx=1;sx<dicnumber+1;sx++){
if(name[s].equals(dic[sx]))h=100;
}
if(h<50)dicnumber=dicnumber+1;
if(h<50)dic[dicnumber]=name[s];
}
System.out.println(dicnumber);
for(s=2;s<datanumber+1;s++){
int s1=point[s];
int s2=0;
for(sx=1;sx<dicnumber+1;sx++){
if(name[s].equals(dic[sx]))s2=sx;
}
v[s1][s2]=100;
}
System.out.println(number);
for(s=1;s<13;s++){
for(sx=1;sx<dicnumber+1;sx++){
th[s][sx]=0;
if(Math.random()<0.1)th[s][sx]=100;
}
}
int tr;
for(tr=1;tr<number+1;tr++){
int maxc=-999;
int sxs=0;
for(s=1;s<13;s++){
int c1=0;
for(sx=1;sx<dicnumber+1;sx++){
h=0;
if(v[tr][sx]>60)h=h+1;
if(th[s][sx]>60)h=h+1;
if(h==2)c1=c1+1;
}
if(c1>maxc)sxs=s;
if(c1>maxc)maxc=c1;
}
System.out.println(tr+","+sxs+","+maxc);
}
}
int numx(String str){
int nx;
nx=0;
try{
nx=Integer.parseInt(str);
}catch (Exception e) {}
return nx;
}
void readx(String file){
String str;
BufferedReader br;
int s;
s=0;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8"));
while((str = br.readLine()) != null) {
s=s+1;
data[s]=str;
}
br.close();
} catch (IOException e) {System.out.println(e);}
datanumber=s;
}
}
最終更新:2016年05月05日 11:48