package tv6;
import java.io.*;
public class pro {
int s,datanumber;
String[] data=new String[200000];
String[] date=new String[200000];
String[] y=new String[200000];
String[] m=new String[200000];
String[] d=new String[200000];
String[] w=new String[200000];
int[] h1=new int[200000];
int[] m1=new int[200000];
int[] h2=new int[200000];
int[] m2=new int[200000];
String[] t=new String[20];
String[] dic=new String[20];
int[] point=new int[20];
public static void main(String[] args) {
pro te=new pro();
}
pro(){
String k="月,火,水,木,金,土,日";
String[] ww=k.split(",");
readx("tbs.csv");
int ms;
int year,sea,w5;
for(year=2009;year<2016;year++){
for(sea=1;sea<5;sea++){
for(w5=0;w5<7;w5++){
for(ms=19;ms<24;ms++){
int sx=0;
for(s=2;s<datanumber+1;s++){
String[] x=data[s].split(",");
int y1=numx(x[1]);
int m=numx(x[2]);
String w1=x[4];
int h1=numx(x[5]);
int m1=numx(x[6]);
int h2=numx(x[7]);
int m2=numx(x[8]);
int h=0;
if(y1==year)h=h+1;
if(m>3*sea-3)h=h+1;
if(m<3*sea+1)h=h+1;
double d1=h1+(double)m1/60;
double d2=h2+(double)m2/60;
if(w1.equals(ww[w5]))h=h+1;
if(d1<ms+0.1)h=h+1;
if(d2>ms+0.5)h=h+1;
if(h==6)sx=sx+1;
if(h==6)t[sx]=x[9];
}
int number=sx;
int delta=0;
dic[0]="";
for(s=1;s<number+1;s++){
int h=0;
for(sx=1;sx<delta+1;sx++){
if(t[s].equals(dic[sx]))h=100;
}
if(h<60)delta=delta+1;
if(h<60)dic[delta]=t[s];
}
for(sx=1;sx<delta+1;sx++){
point[sx]=0;
}
for(s=1;s<number+1;s++){
for(sx=1;sx<delta+1;sx++){
if(t[s].equals(dic[sx]))point[sx]=point[sx]+1;
}
}
String de=dic[1];
int maxpoint=point[1];
for(sx=2;sx<delta+1;sx++){
if(point[sx]>maxpoint)de=dic[sx];
if(point[sx]>maxpoint)maxpoint=point[sx];
}
System.out.println(year+","+(3*sea-2)+","+ww[w5]+","+ms+","+de);
}
}
}
}
}
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年08月31日 01:30