package con2;
public class pro {
double[] c=new double[60];
double[] cx=new double[60];
double[] rate=new double[60];
double v1;
String[] credit=new String[6000];
int number;
int[] v=new int[100];
public static void main(String[] args) {
pro test=new pro();
}
pro(){
io sub=new io();
sub.makedata();
c=sub.c;
int s;
double c1=0;
for(s=1;s<26;s++){
c1=c1+c[s];
}
System.out.println(c1);
for(s=1;s<26;s++){
rate[s]=c[s]/c1;
}
ken sub2=new ken();
sub2.makedata("2010","p2");
v=sub2.v;
credit=sub2.credit;
number=sub2.number;
v1=0;
for(s=1;s<number+1;s++){
if(credit[s].equals("c6"))v1=v[s];
}
for(s=1;s<26;s++){
cx[s]=v1*rate[s];
}
for(s=1;s<26;s++){
System.out.println(s+","+cx[s]/100);
}
}
}
package con2;
import tool.*;
public class io {
int s,datanumber;
String[] data=new String[6000];
int[][] mat=new int[100][100];
String[] index=new String[6000];
int[] y=new int[100];
double[][] io=new double[100][100];
int[][] a=new int[100][100];
double[] c=new double[60];
void makedata(){
readfile sub=new readfile();
sub.makedata("sna.csv","UTF-8");
data=sub.data;
datanumber=sub.datanumber;
int sx;
for(s=2;s<datanumber+1;s++){
data[s]=change(data[s]);
String[] x=data[s].split(",");
index[s-1]=x[0];
for(sx=1;sx<x.length;sx++){
mat[s-1][sx]=numx(x[sx]);
}
}
for(s=1;s<26;s++){
y[s]=mat[32][s];
for(sx=1;sx<26;sx++){
a[s][sx]=mat[s][sx];
}
}
for(s=1;s<26;s++){
c[s]=mat[s][27]+mat[s][30];
}
for(s=1;s<26;s++){
for(sx=1;sx<26;sx++){
io[s][sx]=(double)a[s][sx]/y[sx];
}
}
}
int numx(String str){
int nx;
nx=0;
try{
nx=Integer.parseInt(str);
}catch (Exception e) {}
return nx;
}
String change(String str){
String str5=str;
int px=str5.indexOf("\"");
while(px>-1){
str5=rev(str5);
px=str5.indexOf("\"");
}
return str5;
}
String rev(String str){
int p1=str.indexOf("\"");
int p2=str.indexOf("\"",p1+1);
String str1=str.substring(0,p1);
String str2=str.substring(p1+1,p2);
String str3=str.substring(p2+1,str.length());
str2=str2.replace(",","");
return str1+str2+str3;
}
}
package con2;
import tool.*;
public class ken {
int s,datanumber;
String[] data=new String[6000];
int[][] mat=new int[100][100];
String[] credit=new String[6000];
int[] y=new int[100];
int[] v=new int[100];
double[][] io=new double[100][100];
int[][] a=new int[100][100];
int[] c=new int[100];
int number;
void makedata(String y1,String p1){
readfile sub2=new readfile();
sub2.makedata("p.csv","UTF-8");
data=sub2.data;
datanumber=sub2.datanumber;
int h,sx;
sx=0;
for(s=1;s<datanumber+1;s++){
String[] x=data[s].split(",");
h=0;
if(x[0].equals(y1))h=h+1;
if(x[1].equals(p1))h=h+1;
if(h==2)sx=sx+1;
if(h==2)credit[sx]=x[2];
if(h==2)v[sx]=numx(x[3]);
}
number=sx;
}
int numx(String str){
int nx;
nx=0;
try{
nx=Integer.parseInt(str);
}catch (Exception e) {}
return nx;
}
double num(String str){
double nx;
nx=0;
try{
nx=Double.parseDouble(str);
}catch (Exception e) {}
return nx;
}
}
最終更新:2016年05月27日 02:16