#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#include "set.h"
#include "glva.h"


void shus_econ_out(void){
	int k;
	int is, ie, ii;
	FILE *ofp;
	
	if(Seidn!=0){
		is=ie=0;
	} else {
		if(Cntlset==1) is=0;
		else           is=1;
		ie=4;
	}
	
	for(ii=is; ii<=ie; ii++){
		ofp = ofp01_shushi[ii];
		
		fprintf(ofp, "沸貉涟捏霹\n");
		fprintf(ofp, "钳刨,湿擦,穆垛,笨脱网搀り,孺毋猖年唯,孺毋贷痕68盒,答撩猖年唯,答撩贷痕68盒,\n");
		for(k=5; k<=Ke; k++){
			fprintf(ofp, "%3d, %5.2f, %5.2f, %5.2f, ", k, Ci[k-ECSTY]*100.0, H[k-ECSTY]*100.0, Ri[k-ECSTY]*100.0);
			fprintf(ofp, "%5.2f, %5.2f, %5.2f, %5.2f,\n",
			    (Krb[k-ECSTY][67-ECXA]-1.0)*100.0,(Krb[k-ECSTY][68-ECXA]-1.0)*100.0,
			    (Kra[k-ECSTY][67-ECXA]-1.0)*100.0,(Kra[k-ECSTY][68-ECXA]-1.0)*100.0);
		}
		fprintf(ofp, "\n");
	}
}



void shus_nin_out(void){ 
	int s, i, k, x;
	int is, ie, ii;
	int s2;
	double t4sx[5][4][7][ENDY-STTY+1];
	FILE *ofp;
	
	for(ii=0; ii<5; ii++){
		for(s=0; s<4; s++){
			for(i=0; i<7; i++){
				for(k=0; k<ENDY-STTY+1; k++){
					t4sx[ii][s][i][k] = 0.;
				}
			}
		}
	}
	
	if(Seidn!=0){
		is=ie=0;
	} else {
		is=1; 
		ie=4;
	}
	
	for(ii=is; ii<=ie; ii++){
		if((Cntlset!=1 && (Seidn==1 || ii==1)) ||
		   (Cntlset==1 && (ii<=1))               ) s2 = 3;
		else                                       s2 = 2;
		
		for(s=0; s<=s2; s++){
			for(i=0; i<7; i++){
				for(k=Ks+1; k<=Ke; k++){
					if(Cntlset!=1){  
						for(x=XA-1; x<=XB; x++){
							t4sx[ii][s][i][k-STTY] += T4xtp[ii][s][i][k-STTY][x];
						}
					 } else {  
						for(x=XA-1; x<=XB; x++){
							t4sx[ii][s][i][k-STTY] += T4xtp[ii][s][i][k-STTY][x];
							if(ii==1 || (ii>1 && k>Kyoskijun)){
								t4sx[0][s][i][k-STTY] += T4xtp[ii][s][i][k-STTY][x];
							} else if(k==Kyoskijun){
								t4sx[0][s][i][k-STTY] += T4xtp[ii][s][i][k-STTY][x]/2.;
							}
						}
					}
				}
			}
		}
		
		if(Cntlset==1){
			for(s=0; s<=s2; s++){
				for(k=Ks+1; k<=Ke; k++){
					if(ii==1 || (ii>1 && k>Kyoskijun)){
						Ap[0][s][k-STTY]   += Ap[ii][s][k-STTY];
						Ap65[0][s][k-STTY] += Ap65[ii][s][k-STTY];
					} else if(k==Kyoskijun){
						Ap[0][s][k-STTY]   += Ap[ii][s][k-STTY]   / 2.;
						Ap65[0][s][k-STTY] += Ap65[ii][s][k-STTY] / 2.;
					}
				}
			}
		}
	}
	
	if(Cntlset==1) is=0;
	
	for(ii=is; ii<=ie; ii++){
		ofp = ofp01_shushi[ii];
		
		if((Cntlset!=1 && (Seidn==1 || ii==1)) ||
		   (Cntlset==1 && (ii<=1))               ) s2 = 3;
		else                                       s2 = 2;
		
		fprintf(ofp, "钳刨,蕊瘦副荚,戏勿,戏哼,奶戏,奶哼,俱巢,颁虏,");
		fprintf(ofp, "蕊瘦副荚ˇ盟,蕊瘦副荚ˇ谨,");
		fprintf(ofp, "65盒笆惧蕊瘦副荚ˇ盟,65盒笆惧蕊瘦副荚ˇ谨,");
		fprintf(ofp, "戏勿,戏哼,奶戏,奶哼,俱巢,颁虏,");
		fprintf(ofp, "戏勿,戏哼,奶戏,奶哼,俱巢,颁虏,");
		if(s2==3){
			fprintf(ofp, "戏勿,戏哼,奶戏,奶哼,俱巢,颁虏");
		}
		fprintf(ofp, "\n");
		
		for(k=FLKS_SHU; k<=FLKE_SHU; k++){
			fprintf(ofp, "%3d,", k);
			fprintf(ofp, "%14.8e,", Ap[ii][0][k-STTY]);
			for(i=1; i<=6; i++) fprintf(ofp, "%14.8e,", t4sx[ii][0][i][k-STTY]);
			fprintf(ofp, "%14.8e,%14.8e,", Ap[ii][1][k-STTY]  +Ap[ii][3][k-STTY],   Ap[ii][2][k-STTY]);
			fprintf(ofp, "%14.8e,%14.8e,", Ap65[ii][1][k-STTY]+Ap65[ii][3][k-STTY], Ap65[ii][2][k-STTY]);
			for(s=1; s<=s2; s++){
				for(i=1; i<=6; i++){
					fprintf(ofp, "%14.8e,", t4sx[ii][s][i][k-STTY]);
				}
			}
			fprintf(ofp, "\n");
		}
	}
	
	if(Cntlset==1 && (Saimu==0 ||Saimu==1 || Saimu==2)){
		
		for(ii=1; ii<=4 ; ii++){
			for(i=1; i<=6 ; i++){
				if(i==1 || i==2){
					s=0;
				} else if (i<=4){
					s=1;
				} else {
					s=i-3;
				}
				for(k=FLKS; k<=FLKE; k++){
					Ukyu[0][ii][s][k-STTY] += t4sx[ii][0][i][k-STTY];
					Ukyu[0][0][s][k-STTY]  += t4sx[ii][0][i][k-STTY];
				}
			}
		}
	}
}



void shus_shushiout(int mode){  
	int k, i;
	int kend_t, kend_h;              
	double dtemp;
	FILE *ofp;
	int is, ie, ii, psd;
	double tanni[31];
	
	for(i=0; i<31; i++){
		if(i<=25 || i==30){
			tanni[i] = 1.0E-8;
		}else if(i==27 || i==28){
			tanni[i] = 1.0E+2;
		}else{
			tanni[i] = 1.0;
		}
	}
	
	if(Seidn!=0){
		is=ie=0;
	} else {
		if(Cntlset==1) is=0;
		else           is=1;
		ie=4;
	}
	
	if(mode==1){ 
		kend_h = 0;
		dtemp = Escutrrh[Ke-1-ECSTY][67-ECXA];
		for(k=Ke-1; k>=Ks+1; k--){
			if(Escutrrh[k-1-ECSTY][67-ECXA]-dtemp>1.0E-13){
				kend_h = k;
				break;
			} else {
				dtemp = Escutrrh[k-1-ECSTY][67-ECXA];
			}
		}
		kend_t = 0;
		dtemp = Escutrrt[Ke-1-ECSTY][67-ECXA];
		for(k=Ke-1; k>=Ks+1; k--){
			if(Escutrrt[k-1-ECSTY][67-ECXA]-dtemp>1.0E-13){
				kend_t = k;
				break;
			} else {
				dtemp = Escutrrt[k-1-ECSTY][67-ECXA];
			}
		}
	}
	
	for(ii=is; ii<=ie; ii++){
		ofp = ofp01_shushi[ii];
		
		if(mode==1){
			if(ie==0 || ii==1) printf(" 拇腊呵姜钳刨 ");
			fprintf(ofp, "\n拇腊呵姜钳刨, ");
			if(kend_h!=0 && kend_h!=Ke-1){
				if(ie==0 || ii==1)
				  printf(" 更钳¨%3d (%.13f) ", kend_h, Escutrrh[MAX(0,kend_h-ECSTY)][67-ECXA]*100.);
				fprintf(ofp, " 更钳, %3d, %20.14e, ", kend_h, Escutrrh[MAX(0,kend_h-ECSTY)][67-ECXA]);
			} else {
				if(ie==0 || ii==1) printf(" 更钳¨ -  (%20.14e)", Escutrrh[Ke-1-ECSTY][67-ECXA]);
				fprintf(ofp, " 更钳, - , - , ");
			}
			if(kend_t!=0 && kend_t!=Ke-1){
				if(ie==0 || ii==1)
				  printf(" 柜钳¨%3d (%.13f)\n", kend_t, Escutrrt[MAX(0,kend_t-ECSTY)][67-ECXA]*100.);
				fprintf(ofp, " 柜钳, %3d, %20.14e\n", kend_t, Escutrrt[MAX(0,kend_t-ECSTY)][67-ECXA]);
			} else {
				if(ie==0 || ii==1) printf(" 柜钳¨ -  (%20.14e)\n", Escutrrt[Ke-1-ECSTY][67-ECXA]);
				fprintf(ofp, " 柜钳, - , - \n");
			}
		}
		
		fprintf(ofp, "\n");
		
		if(mode==0){
			fprintf(ofp, "\n箭毁斧奶し≮スライド拇腊涟≯\n");
		} else {
			fprintf(ofp, "\n箭毁斧奶し≮スライド拇腊稿≯\n");
		}
		
		fprintf(ofp,"钳刨,箭掐纷,瘦副瘟箭掐,(浩)惧捐せ尸,笨脱箭掐,柜杆砷么,");
		fprintf(ofp, "(浩)柜杆答撩,(浩)柜杆沸册孺毋,(浩)柜杆沸册年驰,");
		fprintf(ofp, "(浩)柜杆かさ惧げ,毁辩驰箭掐,羌烧垛,");
		fprintf(ofp, "毁叫纷,迫极惦烧,(浩)迫极孺毋,(浩)迫极年驰废,");
		fprintf(ofp, "(浩)迫极裁惦,答撩钳垛凋叫垛,祸坛锐,毁辩驰毁叫,");
		fprintf(ofp, "箭毁汗,钳刨琐姥惟垛,姥惟垛(附哼擦呈),");
		fprintf(ofp, "(浩)パ〖ト瘦副瘟,另鼠椒另驰,另鼠椒驰,伴基鼠椒驰,姥惟刨圭,瘦副瘟唯,申草瘦副瘟唯,,");
		fprintf(ofp, "菏姥み尸芹霹,\n");
		
		
		for(k=FLKS_SHU; k<=FLKE_SHU; k++){
			
			if(k>=ECSTY && k<=ECEDY){
				Cc[ii][21][k-STTY] = Cc[ii][20][k-STTY] / Id_Hhd[k-ECSTY];
			} else {
				Cc[ii][21][k-STTY] = 0.;
			}
			if(Cc[ii][11][k-STTY]>0.){
				Cc[ii][26][k-STTY] = Cc[ii][20][k-1-STTY] / Cc[ii][11][k-STTY];
			} else {
				Cc[ii][26][k-STTY] = 0.;
			}
			if(ii==0) psd=1;
			else      psd=ii2psd(ii);
			
			if(k>=ECSTY && k<=ECEDY){
					Cc[ii][27][k-STTY] = Prema[psd][k-STTY];
			}
			
			if(Cc[ii][23][k-STTY]>0.){
				Cc[ii][28][k-STTY] = ( Cc[ii][11][k-STTY] - Cc[ii][2][k-STTY] - Cc[ii][4][k-STTY]
				                      -Cc[ii][9][k-STTY] - Cc[ii][10][k-STTY])
			        	            / Cc[ii][24][k-STTY];
			} else {
				Cc[ii][28][k-STTY] = 0.;
			}
			
			fprintf(ofp, "%3d,", k);
			for(i=0; i<31; i++){
				if(Cntlset!=1 || ii==1 || k!=Kyoskijun-1 || i!=30){
					fprintf(ofp, "%20.13e,", Cc[ii][i][k-STTY] * tanni[i]);
				} else { 
					fprintf(ofp, "%20.13e,", Siwake[ii] * tanni[i]);
				}
			}
			if(Cntlset==1 && ii==0 && k==Kyoskijun){
				for(i=1; i<=17; i++){
					if((i>=2&&i<=4) || (i>=9&&i<=12)) continue;
					dtemp=0.;
					for(psd=2; psd<=4; psd++){
						dtemp += Dc[psd][i];
					}
					fprintf(ofp, "%20.13e,", dtemp/1.0E+8);
				}
			}
			fprintf(ofp, "\n");
		}
	}
	
}



void shus_cutout(void){
	
	int k, i;
	FILE *ofp;
	
	ofp = ofp_cuta;
	
	for(k=5; k<=8; k++){
		fprintf(ofp, "%4d,", k);
		for(i=63; i<=115; i++) fprintf(ofp, "%20.14e,", 1.);
		fprintf(ofp, "\n");
	}
	for(k=9; k<=FLKE; k++){
		fprintf(ofp, "%4d,", k);
		for(i=63; i<=115; i++) fprintf(ofp, "%20.14e,", Escutrrt[k-ECSTY][i-ECXA]);
		fprintf(ofp, "\n");
	}
	
	ofp = ofp_cutb;
	
	for(k=5; k<=8; k++){
		fprintf(ofp, "%4d,", k);
		for(i=63; i<=115; i++) fprintf(ofp, "%20.14e,", 1.);
		fprintf(ofp, "\n");
	}
	for(k=9; k<=FLKE; k++){
		fprintf(ofp, "%4d,", k);
		for(i=63; i<=115; i++) fprintf(ofp, "%20.14e,", Escutrrh[k-ECSTY][i-ECXA]);
		fprintf(ofp, "\n");
	}
}



void shus_summary(void){
	FILE *ofp;
	int k, ii, i;
	int kend_t, kend_h;
	double r1, r1h, r1k, r2, r2h ,r2k;
	double dtemp;
	
	ofp=ofp03_summary;
	
	if(Saimu==0){
		fprintf(ofp, "%s, %s, %s\n", Nfile, Nfile2, Nfile3);
	} else {
		fprintf(ofp, "%s, %s, %s, %s\n", Saimushu, Nfile, Nfile2, Nfile3);
	}
	fprintf(ofp, "%s, %s\n", Ecfile, Wcfile);
	if(Saimu==0){
		fprintf(ofp, "%s\n", Nkfile);
	} else {
		fprintf(ofp, "%s, %s\n", Saimuski, Nkfile);
	}
	fprintf(ofp, "%s, 徒洒:, %s, Cntlset:, %d, Seidn:, %d\n",
	                          Sifile, Cutrfile4, Cntlset, Seidn);
	fprintf(ofp, "\n");
	fprintf(ofp, "Flg_Part,%d,, Flg_Dmakuro,%d\n\n", Flg_Part, Flg_Dmakuro);
	
	kend_h = 0;
	dtemp = Escutrrh[Ke-1-ECSTY][67-ECXA];
	for(k=Ke-1; k>=Ks+1; k--){
		if(Escutrrh[k-1-ECSTY][67-ECXA]-dtemp>1.0E-13){
			kend_h = k;
			break;
		} else {
			dtemp = Escutrrh[k-1-ECSTY][67-ECXA];
		}
	}
	kend_t = 0;
	dtemp = Escutrrt[Ke-1-ECSTY][67-ECXA];
	for(k=Ke-1; k>=Ks+1; k--){
		if(Escutrrt[k-1-ECSTY][67-ECXA]-dtemp>1.0E-13){
			kend_t = k;
			break;
		} else {
			dtemp = Escutrrt[k-1-ECSTY][67-ECXA];
		}
	}
	fprintf(ofp, "姜位钳刨¨,更钳,%d,%20.14e,柜钳,%d, %20.14e\n\n",
	         kend_h, 1.0-Escutrrh[Ke-ECSTY][67-ECXA], kend_t, 1.0-Escutrrt[Ke-ECSTY][67-ECXA]);
	
	fprintf(ofp, "沸貉涟捏霹\n");
	fprintf(ofp, "钳刨,湿擦,穆垛,笨脱网搀り,孺毋猖年唯,孺毋贷痕68盒,答撩猖年唯,答撩贷痕68盒,");
	fprintf(ofp, "钳垛驰,うち孺毋,うち答撩,材借尸疥评,");
	fprintf(ofp, "洛仑唯(办傅步),うち孺毋,うち答撩,洛仑唯,");
	fprintf(ofp, "孺毋カット67,孺毋カット68,答撩カット67,答撩カット68,mファイル,");
	fprintf(ofp, "幚幙钳垛驰,幚幙孺毋,幚幙答撩,幚幙材借尸\n");
	
	r1 = r1h = r1k = r2 = r2h = r2k =0.;
	for(k=5; k<=Ke; k++){
		fprintf(ofp, "%3d, %5.2f, %5.2f, %5.2f, ", k, Ci[k-ECSTY]*100.0, H[k-ECSTY]*100.0, Ri[k-ECSTY]*100.0);
		fprintf(ofp, "%20.14e, %20.14e, %20.14e, %20.14e, ",
		    (Krb[k-ECSTY][67-ECXA]-1.0)*100.0,(Krb[k-ECSTY][68-ECXA]-1.0)*100.0,
		    (Kra[k-ECSTY][67-ECXA]-1.0)*100.0,(Kra[k-ECSTY][68-ECXA]-1.0)*100.0);
		if(k>=19){
			r1h = Mhirei[k-STTY][0]*Escutrrh[k-ECSTY][67-ECXA];
			r1k = Mkiso[k-STTY]    *Escutrrt[k-ECSTY][67-ECXA];
			r2h = Mhirei[k-STTY][1]*Escutrrh[k-ECSTY][67-ECXA];
			r2k = Mkiso[k-STTY]    *Escutrrt[k-ECSTY][67-ECXA];
		}
		if(k==19){
			r1h = nround(r1h, 0);
			r2h = nround(r2h, 0);
			r1k = nround(r1k, 0);
			r2k = nround(r2k, 0);
		}
		r1 = r1h + r1k;
		r2 = r2h + r2k;
		if(k>=19){
			fprintf(ofp, "%20.14e, %20.14e, %20.14e, %20.14e, ", r1, r1h, r1k, Kw[k-STTY][0]);
			fprintf(ofp, "%20.14e, %20.14e, %20.14e, %20.14e, ",
			  r1/Kw[k-STTY][0]*100., r1h/Kw[k-STTY][0]*100., r1k/Kw[k-STTY][0]*100., r1/Kw[k-STTY][0]*100.);
		}else {
			fprintf(ofp, "%20.14e, %20.14e, %20.14e, %20.14e, ", 0., 0., 0., 0.);
			fprintf(ofp, "%20.14e, %20.14e, %20.14e, %20.14e, ", 0., 0., 0., 0.);
		}
		fprintf(ofp, "%20.14e, %20.14e, %20.14e, %20.14e, %20.14e,",
		    Escutrrh[k-ECSTY][67-ECXA], Escutrrh[k-ECSTY][68-ECXA],
		    Escutrrt[k-ECSTY][67-ECXA], Escutrrt[k-ECSTY][68-ECXA],
		    Scutrk1[k-ECSTY]);
		if(k>=19){
			fprintf(ofp, "%20.14e, %20.14e, %20.14e, %20.14e,\n",
			  r1/Id_Cid[k-ECSTY], r1h/Id_Cid[k-ECSTY], r1k/Id_Cid[k-ECSTY], Kw[k-STTY][0]/Id_Cid[k-ECSTY]);
		} else {
			fprintf(ofp, "%20.14e, %20.14e, %20.14e, %20.14e,\n", 0., 0., 0., 0.);
		}
	}
	fprintf(ofp, "\n");
	
	fprintf(ofp, "\n,链更钳,,,,,奠更钳,,,,,柜鼎,,,,,孟鼎,,,,,讳池,,,,,\n");
	fprintf(ofp, "钳刨,");
	for(ii=0; ii<=4; ii++) fprintf(ofp, "蕊瘦副荚,戏勿陵碰,奶戏陵碰,俱巢,颁虏,");
	fprintf(ofp, "\n");
	for(k=FLKS; k<=FLKE; k++){
		fprintf(ofp, "%3d,", k);
		Ap[0][0][k-STTY] = Ap[1][0][k-STTY];
		for(ii=2; ii<=4; ii++) Ap[0][0][k-STTY] += Ap[ii][0][k-STTY]; 
		for(ii=0; ii<=4; ii++){
			fprintf(ofp, "%20.14e, %20.14e, %20.14e, %20.14e, %20.14e,", Ap[ii][0][k-STTY],
			  Ukyu[0][ii][0][k-STTY],Ukyu[0][ii][1][k-STTY],
			  Ukyu[0][ii][2][k-STTY],Ukyu[0][ii][3][k-STTY]);
		}
		fprintf(ofp, "\n");
	}
	fprintf(ofp, "\n");
	
	fprintf(ofp, "箭毁[链更钳１:tou]\n\n");
	fprintf(ofp, "钳刨,");
	fprintf(ofp, "箭掐纷, 瘦副瘟, 笨脱箭掐, 柜杆砷么, うち答撩, うち沸册弄柜杆, 毁辩掐, 羌烧垛,");
	fprintf(ofp, "毁叫纷,迫极惦烧,答撩钳垛凋叫垛,省汇,毁辩叫,箭毁汗,");
	fprintf(ofp, "姥惟垛, 附哼擦猛, 另鼠椒, 另鼠椒(伴基霹近く), 瘦副瘟唯,菏姥み,交吗突获∈侍非∷,,");
	fprintf(ofp, "戏勿陵碰,奶戏陵碰,俱巢,颁虏\n");
	for(k=FLKS; k<=FLKE; k++){
		fprintf(ofp, "%3d,", k);
		for(i=0; i<=30; i++){
			if(i==2 || i==7 || i==8 || (i>=13 && i<=15) || i==22 || (i>=25 && i!=27 && i!=30)){
				continue;
			}
			if(i==6){
				dtemp = Cc[0][6][k-STTY] + Cc[0][7][k-STTY] + Cc[0][8][k-STTY];
			} else {
				dtemp = Cc[0][i][k-STTY];
			}
			if(i!=27) dtemp /= 1.0E+8;
			else      dtemp *= 100.;
			fprintf(ofp, "%20.14e,", dtemp);
		}
		fprintf(ofp, "%20.14e,,", Jyutaku[k-STTY]/1.0E+8);
		for(i=0; i<=3; i++){
			fprintf(ofp, "%20.14e,", 0.);
		}
		fprintf(ofp, "\n");
	}
	fprintf(ofp, "\n\n");
	
	for(k=FLKS; k<=Kyoskijun; k++){
		for(i=0; i<=30; i++){
			if(k!=Kyoskijun || (i!=20 && i!=21)){
				Cc[0][i][k-STTY] = 0.;
			}
			if(k==Kyoskijun) Dc[0][i]  =0.;
			if(i!=0 && i!=3 && i!=19 && i!=20 && i!=21 && (i<=25 || i==30)){
				for(ii=1; ii<=4; ii++){
					Cc[0][i][k-STTY] += Cc[ii][i][k-STTY];
					if(k==Kyoskijun) Dc[0][i] += Dc[ii][i];
				}
			}
		}
	}
	Jisout[0] = 0.;
	for(ii=2; ii<=4; ii++) Jisout[0] += Jisout[ii];
	
	for(ii=0; ii<=4; ii++){
		fprintf(ofp, "\n");
		if(ii==0) fprintf(ofp, "箭毁[链更钳２:箭毁脱]\n\n");
		if(ii==1) fprintf(ofp, "箭毁[奠更钳]\n\n");
		if(ii==2) fprintf(ofp, "箭毁[柜鼎貉]\n\n");
		if(ii==3) fprintf(ofp, "箭毁[孟鼎貉]\n\n");
		if(ii==4) fprintf(ofp, "箭毁[讳池鼎貉]\n\n");
		fprintf(ofp, "钳刨,");
		fprintf(ofp, "箭掐纷, 瘦副瘟, 笨脱箭掐, 柜杆砷么, うち答撩, うち沸册弄柜杆, 毁辩掐, 羌烧垛,");
		fprintf(ofp, "毁叫纷,迫极惦烧,答撩钳垛凋叫垛,省汇,毁辩叫,箭毁汗,");
		fprintf(ofp, "姥惟垛, 附哼擦猛, 另鼠椒, 另鼠椒(伴基霹近く), 瘦副瘟唯,菏姥み,交吗突获∈侍非∷,,");
		fprintf(ofp, "戏勿陵碰,奶戏陵碰,俱巢,颁虏\n");

		for(k=FLKS; k<=FLKE; k++){
			fprintf(ofp, "%3d,", k);
			for(i=0; i<=30; i++){
				if(i==2 || i==7 || i==8 || (i>=13 && i<=15) || i==22 || (i>=25 && i!=27 && i!=30)){
					continue;
				}
				if(i==6){
					dtemp = Cc[ii][6][k-STTY] + Cc[ii][7][k-STTY] + Cc[ii][8][k-STTY];
				} else {
					dtemp = Cc[ii][i][k-STTY];
				}
				if(i!=27) dtemp /= 1.0E+8;
				else      dtemp *= 100.;
				fprintf(ofp, "%20.14e,", dtemp);
			}
			if(ii<=1){
				fprintf(ofp, "%20.14e,,", Jyutaku[k-STTY]/1.0E+8);
			} else {
				fprintf(ofp, "%20.14e,,", 0.);
			}
			for(i=0; i<=3; i++){
				fprintf(ofp, "%20.14e,", Ukyu[1][ii][i][k-STTY]);
			}
			fprintf(ofp, "\n");
		}
		fprintf(ofp, "\n\n");
	}
}

void shus_Tokutyoout(void){
	
	int k, x;
	FILE *ofp;
	
	ofp = ofp_Tokutyo;
	
	for(k=5; k<=Ke; k++){
		fprintf(ofp, "%d,", k);
		for(x=67; x<=XB; x++){
			 fprintf(ofp, "%.15f,", Tokutyo[k-ECSTY][x-ECXA]);
		}
		fprintf(ofp, "\n");
	}
	

}

void shus_testout(void){
	int k,ii;
	FILE *ofp;
	
	ofp = ofp_test;
	
	for(k=10; k<=Ke; k++){
		fprintf(ofp, "%d,", k);
		for(ii=0; ii<=9; ii++){
			 fprintf(ofp, "%.15f,", Kokusyushi[ii][k-STTY]);
		}
		fprintf(ofp, "\n");
	}
	

}


