package dora;
public class pro {
String[] name=new String[500];
String[] code=new String[500];
int number;
String[] dic_name=new String[50000];
String[] dic_code=new String[50000];
int dicnumber;
int[][] point=new int[5000][6];
public static void main(String[] args) {
pro te=new pro();
}
pro(){
int s;
select_all sub6=new select_all(); ;
sub6.makedata("tamo","tamo");
name=sub6.name;
code=sub6.code;
number=sub6.number;
dicnumber=0;
int sx;
for(s=1;s<number+1;s++){
int h=0;
for(sx=1;sx<dicnumber+1;sx++){
if(code[s].equals(dic_code[sx]))h=100;
}
if(h<50)dicnumber=dicnumber+1;
if(h<50)dic_name[dicnumber]=name[s];
if(h<50)dic_code[dicnumber]=code[s];
}
System.out.println(dicnumber);
int y1=2012;
for(y1=2012;y1<2014;y1++){
for(sx=1;sx<dicnumber+1;sx++){
point[sx][1]=0;
point[sx][2]=0;
point[sx][3]=0;
point[sx][4]=0;
point[sx][5]=0;
}
select sub=new select(); ;
sub.makedata("tamo","tamo",y1);
name=sub.name;
code=sub.code;
number=sub.number;
for(s=1;s<number+1;s++){
int sxs=0;
for(sx=1;sx<dicnumber+1;sx++){
if(code[s].equals(dic_code[sx]))sxs=sx;
}
if(code[s].length()<1)sxs=0;
if(sxs>0)point[sxs][1]=100;
}
select sub2=new select(); ;
sub2.makedata("smap","smap",y1);
name=sub2.name;
code=sub2.code;
number=sub2.number;
for(s=1;s<number+1;s++){
int sxs=0;
for(sx=1;sx<dicnumber+1;sx++){
if(code[s].equals(dic_code[sx]))sxs=sx;
}
if(code[s].length()<1)sxs=0;
if(sxs>0)point[sxs][2]=100;
}
select sub3=new select(); ;
sub3.makedata("sanma","sanma",y1);
name=sub3.name;
code=sub3.code;
number=sub3.number;
for(s=1;s<number+1;s++){
int sxs=0;
for(sx=1;sx<dicnumber+1;sx++){
if(code[s].equals(dic_code[sx]))sxs=sx;
}
if(code[s].length()<1)sxs=0;
if(sxs>0)point[sxs][3]=100;
}
select sub4=new select(); ;
sub4.makedata("tetu","tetu",y1);
name=sub4.name;
code=sub4.code;
number=sub4.number;
for(s=1;s<number+1;s++){
int sxs=0;
for(sx=1;sx<dicnumber+1;sx++){
if(code[s].equals(dic_code[sx]))sxs=sx;
}
if(code[s].length()<1)sxs=0;
if(sxs>0)point[sxs][4]=100;
}
select sub5=new select(); ;
sub5.makedata("ton","ton",y1);
name=sub5.name;
code=sub5.code;
number=sub5.number;
for(s=1;s<number+1;s++){
int sxs=0;
for(sx=1;sx<dicnumber+1;sx++){
if(code[s].equals(dic_code[sx]))sxs=sx;
}
if(code[s].length()<1)sxs=0;
if(sxs>0)point[sxs][5]=100;
}
for(s=1;s<dicnumber+1;s++){
int m1=0;
if(point[s][1]>50)m1=m1+1;
if(point[s][2]>50)m1=m1+1;
if(point[s][3]>50)m1=m1+1;
if(point[s][4]>50)m1=m1+1;
if(point[s][5]>50)m1=m1+1;
if(m1>2)System.out.println(y1+","+m1+","+dic_name[s]+","+dic_code[s]);
}
}
}
}
package dora;
import java.sql.*;
class select{
Connection dbx;
Statement stx;
String sqx;
ResultSet rsx;
int key;
String word;
int sx,number;
String[] name=new String[500];
String[] code=new String[500];
int[] year=new int[500];
int[] month=new int[500];
void makedata(String db,String tab,int yy){
String url = "jdbc:h2:"+db+";create=true";
String usr = "";
String pwd = "";
try
{
Class.forName("org.h2.Driver");
dbx = DriverManager.getConnection(url, usr, pwd);
} catch (Exception ex) { ex.printStackTrace();}
sx=0;
try {
stx = dbx.createStatement();
sqx="select * from "+tab+" WHERE year="+yy;
rsx = stx.executeQuery(sqx);
if (rsx != null) {
while (rsx.next()) {
sx=sx+1;
name[sx]= rsx.getString("name");
code[sx]= rsx.getString("code");
}
}
number=sx;
rsx.close();
stx.close();
dbx.close();
} catch (Exception ex) {ex.printStackTrace();}
}
String change(String word){
String e;
e="'"+word+"'";
return e;
}
}
package dora;
import java.sql.*;
class select_all{
Connection dbx;
Statement stx;
String sqx;
ResultSet rsx;
int key;
String word;
int sx,number;
String[] name=new String[50000];
String[] code=new String[50000];
int[] year=new int[500];
int[] month=new int[500];
void makedata(String db,String tab){
String url = "jdbc:h2:"+db+";create=true";
String usr = "";
String pwd = "";
try
{
Class.forName("org.h2.Driver");
dbx = DriverManager.getConnection(url, usr, pwd);
} catch (Exception ex) { ex.printStackTrace();}
sx=0;
try {
stx = dbx.createStatement();
sqx="select * from "+tab;
rsx = stx.executeQuery(sqx);
if (rsx != null) {
while (rsx.next()) {
sx=sx+1;
name[sx]= rsx.getString("name");
code[sx]= rsx.getString("code");
}
}
number=sx;
rsx.close();
stx.close();
dbx.close();
} catch (Exception ex) {ex.printStackTrace();}
}
String change(String word){
String e;
e="'"+word+"'";
return e;
}
}
最終更新:2016年09月18日 17:28