package goo;
import java.io.*;
public class pro {
int s,datanumber;
String[] data=new String[500000];
int[] year=new int[500000];
int[] month=new int[500000];
int[] day=new int[500000];
String[] time=new String[500000];
String[] timex=new String[500000];
String[] sta=new String[500000];
String[] title=new String[500000];
String[] time1=new String[500];
String[] time2=new String[500];
String[] stax=new String[500];
String[] titlex=new String[500];
String[][] subtime=new String[11][500];
String[][] subtimex=new String[11][500];
String[][] substa=new String[11][500];
String[][] subtitle=new String[11][500];
int[] subnumber=new int[500];
public static void main(String[] args) {
pro t=new pro();
}
pro(){
readx("ren.txt");
for(s=2;s<datanumber+1;s++){
String[] x=data[s].split(",");
year[s]=num_int(x[0]);
month[s]=num_int(x[1]);
day[s]=num_int(x[2]);
time[s]=x[3];
timex[s]=x[4];
sta[s]=x[5];
title[s]=x[6];
}
int sx=0;
for(s=2;s<datanumber+1;s++){
int h=0;
if(year[s]==2014)h=h+1;
if(month[s]==5)h=h+1;
if(day[s]==7)h=h+1;
if(h==3)sx=sx+1;
if(h==3)titlex[sx]=title[s];
if(h==3)stax[sx]=sta[s];
if(h==3)time1[sx]=time[s];
if(h==3)time2[sx]=timex[s];
}
int number=sx;
String[] name=new String[11];
name[1]="NHK";
name[2]="日本テレビ";
name[3]="テレビ朝日";
name[4]="TBS";
name[5]="テレビ東京";
name[6]="フジ";
int m;
for(m=1;m<7;m++){
sx=0;
for(s=1;s<number+1;s++){
int h=0;
if(stax[s].equals(name[m]))h=h+1;
if(h==1)sx=sx+1;
if(h==1)subtitle[m][sx]=titlex[s];
if(h==1)substa[m][sx]=stax[s];
if(h==1)subtime[m][sx]=time1[s];
if(h==1)subtimex[m][sx]=time2[s];
}
subnumber[m]=sx;
}
for(s=1;s<subnumber[2]+1;s++){
System.out.println(subtitle[2][s]);
}
writexml("ren.html");
}
void writexml(String file){
int s,sx;
try{
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file)));
pw.println("<html>");
pw.println("<head> <meta charset=\"utf-8\" /></head>");
pw.println("<body>");
pw.println("<table>");
for(s=1;s<10;s++){
pw.print("<tr>");
for(sx=1;sx<7;sx++){
pw.print("<td>");
pw.print(subtime[sx][s]);
pw.print("</td>");
pw.print("<td>");
pw.print(subtitle[sx][s]);
pw.print("</td>");
}
pw.println("</tr>");
}
pw.println("</table>");
pw.println("</body></html>");
System.out.println("ファイルに書きこみました。");
pw.close();
} catch(IOException ep){ System.out.println("入出力エラーです。"); }
}
double count(String cc){
String[] x1=cc.split(":");
int m1=num_int(x1[0]);
int m2=num_int(x1[1]);
return m1+(double)m2/60;
}
int num_int(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;
}
}
最終更新:2017年01月18日 08:03