PROGRAM BT1_12 PARAMETER (NMAX=100) DIMENSION X(NMAX),X1(NMAX),CHISO(NMAX) DIMENSION F1(NMAX),F2(NMAX),F3(NMAX) INTEGER NAM(NMAX),N,I,N1 REAL A,B,PP1,PP2,PP3 OPEN(1,FILE='C:\MASTER\G_TR\BAITAP~1\NEW\BANG3.TXT') READ(1,*) READ(1,*) READ(1,*)N READ(1,*)((NAM(I),X(I)), I=1,N) CALL SORT(X,N,X1,CHISO,N1) WRITE(*,*)' I ',' Xm ',' F1 ',' F2 ',' F3 ' DO I=1,N1 F1(I)=REAL(I)/REAL(N+1) F2(I)=(REAL(I)-0.25)/(REAL(N)+0.55) F3(I)=(REAL(I)-0.3)/(REAL(N)+0.4) WRITE(*,'(I3,F5.1,3F8.4)') I,X1(I),F1(I),F2(I),F3(I) ENDDO A=28.0 B=30.0 PP1=PROB1(F1,X1,N1,B)-PROB1(F1,X1,N1,A) PP2=PROB1(F2,X1,N1,B)-PROB1(F2,X1,N1,A) PP3=PROB1(F3,X1,N1,B)-PROB1(F3,X1,N1,A) WRITE(*,*) WRITE(*,'(" 1- XS T7 THUOC (",F4.1,",",F4.1,") =",F8.4)') A,B,PP1 WRITE(*,'(" 2- XS T7 THUOC (",F4.1,",",F4.1,") =",F8.4)') A,B,PP2 WRITE(*,'(" 3- XS T7 THUOC (",F4.1,",",F4.1,") =",F8.4)') A,B,PP3 END SUBROUTINE SORT(X,N,X1,CHISO,N1) ! ! CHUONG TRINH NAY SAP XEP CHUOI THANH CHUOI TRINH TU ! VA CHUOI XEP HANG ! ! INPUT: + MANG X DO DAI N CHUA CHUOI SO LIEU BAN DAU ! + N DUNG LUONG MAU ! OUTPUT: + MANG X DO DAI N CHUA CHUOI TRINH TU ! + MANG X1 DO DAI N1 CHUA CHUOI XEP HANG ! + MANG CHISO DO DAI N1 CHUA CHI SO CUA CHUOI XEP HANG ! + N1 SO THANH PHAN TRONG CHUOI XEP HANG ! DIMENSION X(1),X1(1),CHISO(1) INTEGER N,N1,I,J,K REAL TMP ! SAP XEP THANH CHUOI TRINH TU TANG DAN DO I=1,N-1 DO J=I+1,N IF (X(J).LT.X(I)) THEN TMP=X(J) X(J)=X(I) X(I)=TMP ENDIF ENDDO ENDDO ! XAC DINH CAC THANH PHAN CUA CHUOI XEP HANG N1=1 I=1 X1(N1)=X(I) CHISO(N1)=REAL(I) 10 I=I+1 IF (I.GT.N) GOTO 100 IF (X(I).NE.X(I-1)) THEN N1=N1+1 X1(N1)=X(I) ENDIF GOTO 10 100 CONTINUE ! TINH CHI SO CUA CAC THANH PHAN TRONG CHUOI XEP HANG DO J=1,N1 K=0 CHISO(J)=0.0 DO I=1,N IF (X(I).EQ.X1(J)) THEN K=K+1 CHISO(J)=CHISO(J)+REAL(I) ENDIF ENDDO CHISO(J)=CHISO(J)/REAL(K) ENDDO RETURN END FUNCTION PROB1(FR,XC,M,X0) C C HAM NAY TINH UOC LUONG XAC SUAT P(X