package ameske;
import tool.*;
public class pro {
String[] data=new String[5000];
int s,sx,datanumber,sxs;
String[] date=new String[50000];
String[] title=new String[50000];
String[] artist=new String[50000];
String[] nick=new String[50000];
int artistnumber,number;
String[] credit=new String[50000];
String[] pdate=new String[50000];
String[] ptitle=new String[50000];
int[] com=new int[50000];
int[] oldcom=new int[50000];
String[] olddate=new String[50000];
String[] oldtitle=new String[50000];
String str;
int p1,p2;
int[] year=new int[50000];
int[] month=new int[50000];
String[] dic=new String[500];
public static void main(String[] args) {
pro test=new pro();
}
pro(){
faststep();
secondstep();
int y1,m1,c1;
for(s=1;s<artistnumber+1;s++){
System.out.print(dic[s]);
if(s<artistnumber)System.out.print(",");
}
System.out.println("");
for(m1=1;m1<13;m1++){
for(s=1;s<artistnumber+1;s++){
y1=2012;
c1=x(s,y1,m1);
System.out.print(c1);
if(s<artistnumber)System.out.print(",");
}
System.out.println("");
}
for(m1=1;m1<11;m1++){
for(s=1;s<artistnumber+1;s++){
y1=2013;
c1=x(s,y1,m1);
System.out.print(c1);
if(s<artistnumber)System.out.print(",");
}
System.out.println("");
}
}
int x(int a,int y1,int m1){
int s,h;
int c1,c2;
c1=0;
c2=0;
for(s=1;s<number+1;s++){
h=0;
if(y1==year[s])h=h+1;
if(m1==month[s])h=h+1;
if(credit[s].equals(dic[a]))h=h+1;
if(h==3)c1=c1+1;
if(h==3)c2=c2+com[s];
}
if(c1>0)c2=c2/c1;
return c2;
}
void secondstep(){
for(s=1;s<number+1;s++){
str=date[s];
String[] x=str.split("-");
year[s]=Integer.parseInt(x[0]);
str="1"+x[1];
month[s]=Integer.parseInt(str)-100;
}
artistnumber=0;
int h;
for(s=1;s<number+1;s++){
h=0;
for(sx=1;sx<artistnumber+1;sx++){
if(credit[s].equals(dic[sx]))h=100;
}
if(h<50)artistnumber=artistnumber+1;
if(h<50)dic[artistnumber]=credit[s];
}
}
void faststep(){
readfile sub=new readfile();
sub.makedata("new.txt", "UTF-8");
data=sub.data;
datanumber=sub.datanumber;
String str;
for(s=1;s<datanumber+1;s++){
catchword sub2=new catchword();
date[s]=sub2.makedata(data[s],"date");
title[s]=sub2.makedata(data[s],"title");
str=sub2.makedata(data[s],"com");
com[s]=Integer.parseInt(str);
}
number=datanumber;
readfile sub6=new readfile();
sub6.makedata("old.txt", "UTF-8");
data=sub6.data;
datanumber=sub6.datanumber;
for(s=1;s<datanumber+1;s++){
catchword sub7=new catchword();
olddate[s]=sub7.makedata(data[s],"date");
oldtitle[s]=sub7.makedata(data[s],"title");
str=sub7.makedata(data[s],"com");
oldcom[s]=Integer.parseInt(str);
}
for(s=1;s<number+1;s++){
sxs=0;
for(sx=1;sx<datanumber;sx++){
if(date[s].equals(olddate[sx]))sxs=sx;
}
}
int tx;
tx=number;
for(s=sxs;s<datanumber+1;s++){
tx=tx+1;
title[tx]=oldtitle[s];
date[tx]=olddate[s];
com[tx]=oldcom[s];
}
number=tx;
readfile sub3=new readfile();
sub3.makedata("nick.txt", "UTF-8");
data=sub3.data;
datanumber=sub3.datanumber;
for(s=1;s<datanumber+1;s++){
catchword sub4=new catchword();
artist[s]=sub4.makedata(data[s],"artist");
nick[s]=sub4.makedata(data[s],"nick");
}
artistnumber=datanumber;
int sxs;
for(s=1;s<number+1;s++){
sxs=0;
for(sx=1;sx<artistnumber+1;sx++){
if(title[s].indexOf(nick[sx])>-1)sxs=sx;
}
credit[s]="noname";
if(sxs>0)credit[s]=artist[sxs];
}
}
}
最終更新:2013年11月11日 05:16