アットウィキロゴ

あsh

import java.io.*;

class pro{

String[] data=new String[50000];
int s,sx,sxs,datanumber,dicnumber;
int[][] nword=new int[500][50000];
String[] dic=new String[50000];
int tr,m,n;
String str;
int t;

public static void main(String args[]){
pro test=new pro();
}

pro(){

readfile("dic.txt");

for(s=1;s<datanumber+1;s++){
String[] x=data[s].split(",");
if(x.length>1)dic[s]=x[1];
}

dicnumber=datanumber;

t=0;

for(m=13;m<20;m++){

for(tr=1;tr<makenum(m)+1;tr++){

n=m*100;
n=n+tr;

str="ndata/";
str=str+n;
str=str+".txt";

readfile(str);

t=t+1;
for(s=1;s<datanumber+1;s++){
String[] x=data[s].split(",");
if(x.length>1)nword[t][s]=Integer.parseInt(x[1]);
}

System.out.println(datanumber);


}
}



}

int makenum(int year){
int mk;
mk=35;
if(year==13)mk=35;
if(year==14)mk=42;
if(year==15)mk=30;
if(year==16)mk=35;
if(year==17)mk=31;
if(year==18)mk=31;
if(year==19)mk=10;
return mk;
}

void writefile(String str){

try{
PrintWriter pw = new PrintWriter
(new BufferedWriter(new FileWriter(str)));

for(s=1;s<datanumber+1;s++){  
pw.print(s);    
pw.print(",");    
pw.println(nword[s]);    
}      

System.out.println("ファイルに書きこみました。");

pw.close();
}
catch(IOException ep){ System.out.println("入出力エラーです。"); }

}


void readfile(String file){

String str;
BufferedReader br;
int s;
s=0;

try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(file),"SJIS"));  
while((str = br.readLine()) != null) {  
s=s+1;
data[s]=str;  
}
br.close();
} catch (IOException e) {System.out.println(e);}
datanumber=s;

}






}
最終更新:2011年06月03日 15:35