import java.io.*;
class sys{
String file,str;
String[] data=new String[10000];
String[][] date=new String[200][5000];
String[][] title=new String[200][5000];
int number;
int[] num=new int[100];
int[] count=new int[200];
int page;
int s,sx,datanumber;
int n,h;
int p1,p2;
public static void main(String [] args) {
sys test=new sys();
}
sys(){
for(page=1;page<177;page++){
file="db/";
file=file+page;
file=file+".txt";
readfile(file);
count[page]=datanumber;
for(s=1;s<datanumber+1;s++){
String[] x=data[s].split(",");
date[page][s]=x[0];
title[page][s]=x[1];
}
}
for(page=1;page<177;page++){
datanumber=count[page];
for(s=1;s<datanumber+1;s++){
System.out.println(date[page][s]);
p1=date[page][s].indexOf("昭和");
p2=date[page][s].indexOf("平成");
if(p2>-1)p1=p2;
p2=date[page][s].indexOf("年");
h=0;
if(date[page][s].indexOf("規格外")>-1)h=100;
if(h<50)str=date[page][s].substring(p1+2,p2);
if(h<50)makecount(str);
if(h<50)System.out.println(cal());
p1=date[page][s].indexOf("年");
p2=date[page][s].indexOf("月");
h=0;
if(p1>0)h=h+1;
if(p2>0)h=h+1;
if(h==2)str=date[page][s].substring(p1+1,p2);
if(h==2)makecount(str);
if(h==2)System.out.println(cal());
p1=date[page][s].indexOf("月");
p2=date[page][s].indexOf("日");
h=0;
if(p1>0)h=h+1;
if(p2>0)h=h+1;
if(p2==p1+2)h=h+1;
if(p2==p1+3)h=h+1;
if(p2==p1+4)h=h+1;
if(h==3)str=date[page][s].substring(p1+1,p2);
if(h==3)makecount(str);
if(h==3)System.out.println(cal());
}
}
}
int cal(){
int c1;
c1=0;
if(number==3)c1=10*num[1]+num[3];
if(number==2)c1=10+num[2];
if(number==1)c1=num[1];
return c1;
}
void makecount(String str){
String str1;
int s,slong;
slong=str.length();
for(s=0;s<slong;s++){
str1=str.substring(s,s+1);
num[s+1]=count(str1);
}
number=slong;
}
int count(String str){
int c1;
c1=0;
if(str.equals("一"))c1=1;
if(str.equals("二"))c1=2;
if(str.equals("三"))c1=3;
if(str.equals("四"))c1=4;
if(str.equals("五"))c1=5;
if(str.equals("六"))c1=6;
if(str.equals("七"))c1=7;
if(str.equals("八"))c1=8;
if(str.equals("九"))c1=9;
if(str.equals("十"))c1=10;
return c1;
}
void readfile(String file){
String str;
BufferedReader br;
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年07月03日 02:09