アットウィキロゴ

p099

package game;
 
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class pro {
 
     int s,datanumber;
  String[] data=new String[270000];
    int[] point=new int[270000];
     String[] code=new String[270000];
      String[] name=new String[270000];
  String[] date=new String[270000];
      String[] card=new String[27000];
      String[] dic=new String[27000];
 
       int[] v=new int[2700];
   int[] rank=new int[2700];
       int dicnumber=0;
    int sx;
 
    public static void main(String[] args) {
        pro te=new pro();
    }
 
    pro(){
 
    readx("data.csv");
 
    for(s=2;s<datanumber+1;s++){
    String[] x=data[s].split(",");
point[s-1]=numx(x[6]);
code[s-1]="a";
if(x.length>9)code[s-1]=x[9];
name[s-1]=x[5];    
date[s-1]=x[0]+"年"+x[1]+"月"+x[2]+"日";    
 
    }
 
 
        dic[0]="a";
 
for(s=1;s<datanumber;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)card[dicnumber]=name[s];
}
 
for(s=1;s<datanumber;s++){
int sxs=0;
for(sx=0;sx<dicnumber+1;sx++){    
if(code[s].equals(dic[sx]))sxs=sx;
}
v[sxs]=v[sxs]+point[s];
} 
 
ranking();
 
 
sx=rank[2];
String cc=dic[sx];
 
String[] dic_date=new String[500];
int number=0;
 
for(s=1;s<datanumber;s++){
int h=0;
for(sx=1;sx<number+1;sx++){    
if(date[s].indexOf(dic_date[sx])>-1)h=100;
}
if(code[s].equals(cc))h=h+50;
if(h==50)number=number+1;
if(h==50)dic_date[number]=date[s];
} 
 
for(s=1;s<datanumber;s++){
for(sx=1;sx<number+1;sx++){    
int h=0;
if(date[s].equals(dic_date[sx]))h=h+1;
if(code[s].equals(cc))h=h+1;
if(h==2)v[sx]=v[sx]+point[s];
}
} 
 
 
for(sx=1;sx<number+1;sx++){    
System.out.println("date["+sx+"]=\""+dic_date[sx]+"\";");  
System.out.println("point["+sx+"]="+v[sx]+";"); 
}
 
 
 
 
    }
  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;
 
} 
     int numx(String str){
 
    int nx;
 
    nx=0;
 
 try{
 
    nx=Integer.parseInt(str);
 
 }catch (Exception e) {}
 
 return nx;
 
 
 
}
 
   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;
    }
 
 
}
 
 
 
 
}
最終更新:2016年08月17日 05:06