PROGRAM BT_4_17 PARAMETER (MMAX=100,NMAX=100) DIMENSION X(MMAX),Y(NMAX),Z(NMAX+MMAX) INTEGER T(NMAX+MMAX) INTEGER N,M,I,J,NT,NTX,NTY REAL U,V,MUY,XICMA,ALFA,UALFA CHARACTER*15 H0,H1,ANSWER1,ANSWER2 DATA ALFA /0.05/ DATA H0,H1 /'CHAP NHAN H0','BAC BO H0'/ OPEN(1,FILE='C:\MASTER\G_TR\BAITAP~1\NEW\BANG13.TXT') READ(1,*) READ(1,*)M READ(1,*)(X(I),I=1,M) READ(1,*) READ(1,*)N READ(1,*)(Y(I),I=1,N) ! GHEP HAI CHUOI VAO MOT (Z) VA TAO CHUOI DANH DAU (T) DO I=1,M Z(I)=X(I) T(I)=1 ENDDO K=M DO J=1,N K=K+1 Z(K)=Y(J) T(K)=2 ENDDO ! SAP XEP CHUOI DANH DAU UNG VOI CHUOI TRINH TU DO I=1,N+M-1 DO J=I+1,N+M IF (Z(J).LT.Z(I)) THEN ! TMP=Z(J) ! Z(J)=Z(I) ! Z(I)=TMP NT =T(J) T(J)=T(I) T(I)=NT ENDIF ENDDO ENDDO ! TINH T VA T' NTY=0 NTX=0 DO I=1,N+M IF (T(I).EQ.2) NTY=NTY+I IF (T(I).EQ.1) NTX=NTX+I ENDDO MUY=REAL(M*N)/2.0 XICMA=SQRT(REAL(M*N*(M+N+1))/12.0) U=REAL(M*N)+REAL(M*(M+1))/2.0-REAL(NTY) V=REAL(M*N)+REAL(N*(N+1))/2.0-REAL(NTX) WRITE(*,'(" U = ",F10.3)') U WRITE(*,'(" V = ",F10.3)') V IF (U.LT.V) THEN U=(U-MUY)/XICMA ELSE U=(V-MUY)/XICMA ENDIF UALFA=ANINV(1.0-ALFA/2.0,0.0,1.0) IF (ABS(U).LT.UALFA) THEN ANSWER1=H0 ELSE ANSWER1=H1 ENDIF WRITE(*,*)' KET QUA KIEM NGHIEM U PHI THAM SO:' WRITE(*,*)' H0: HAI CHUOI DONG NHAT' WRITE(*,'(" N1 = ",I10)') M WRITE(*,'(" N2 = ",I10)') N WRITE(*,'(" U = ",F10.3)') U WRITE(*,'(" ALFA = ",F10.3)') ALFA WRITE(*,'(" UALFA = ",F10.3)') UALFA WRITE(*,'(" KET LUAN: ",A15)') ANSWER1 END FUNCTION ANORMD(AMUY,XICMA,A,B) ! HAM NAY TINH XAC SUAT DE BIEN NGAU NHIEN PHAN BO CHUAN ! NHAN GIA TRI TRONG KHOANG (A,B): P(A