|
|||||||
ÀâòîÀâòîìàòèçàöèÿÀðõèòåêòóðàÀñòðîíîìèÿÀóäèòÁèîëîãèÿÁóõãàëòåðèÿÂîåííîå äåëîÃåíåòèêàÃåîãðàôèÿÃåîëîãèÿÃîñóäàðñòâîÄîìÄðóãîåÆóðíàëèñòèêà è ÑÌÈÈçîáðåòàòåëüñòâîÈíîñòðàííûå ÿçûêèÈíôîðìàòèêàÈñêóññòâîÈñòîðèÿÊîìïüþòåðûÊóëèíàðèÿÊóëüòóðàËåêñèêîëîãèÿËèòåðàòóðàËîãèêàÌàðêåòèíãÌàòåìàòèêàÌàøèíîñòðîåíèåÌåäèöèíàÌåíåäæìåíòÌåòàëëû è ÑâàðêàÌåõàíèêàÌóçûêàÍàñåëåíèåÎáðàçîâàíèåÎõðàíà áåçîïàñíîñòè æèçíèÎõðàíà ÒðóäàÏåäàãîãèêàÏîëèòèêàÏðàâîÏðèáîðîñòðîåíèåÏðîãðàììèðîâàíèåÏðîèçâîäñòâîÏðîìûøëåííîñòüÏñèõîëîãèÿÐàäèîÐåãèëèÿÑâÿçüÑîöèîëîãèÿÑïîðòÑòàíäàðòèçàöèÿÑòðîèòåëüñòâîÒåõíîëîãèèÒîðãîâëÿÒóðèçìÔèçèêàÔèçèîëîãèÿÔèëîñîôèÿÔèíàíñûÕèìèÿÕîçÿéñòâîÖåííîîáðàçîâàíèå×åð÷åíèåÝêîëîãèÿÝêîíîìåòðèêàÝêîíîìèêàÝëåêòðîíèêàÞðèñïóíäåíêöèÿ |
ÏÐÈËÎÆÅÍÈÅ 8. ÊÎÌÏÜÞÒÅÐÍÀß ÏÐÎÃÐÀÌÌÀ ÐÅØÅÍÈß ÒÐÀÍÑÏÎÐÒÍÎÉ ÇÀÄÀ×È ËÈÍÅÉÍÎÃÎ ÏÐÎÃÐÀÌÌÈÐÎÂÀÍÈß‘ÌÎÄÓËÜ ÃÎËÎÂÍÎÉ ÏÐÎÃÐÀÌÌÛ 1 COLOR 7,0:CLS:LOCATE 2,60,0:COLOR 25,5,15 2 COLOR 7,7,15:LOCATE 3:COLOR 0,7,15 3 PRINT TAB(27)"ÇÀÄÀ×À T R A N";:PRINT SPC(37):PRINT TAB(26)" "; 4 COLOR 15,0,15:PRINT"ÊÀÔÅÄÐÀ";:COLOR 23,5,15:PRINT"*ÁÍÒÓ*"; 5 COLOR 15,0,15:PRINT" ÎÀÏÄÄ ";:COLOR 7,7,15:PRINT SPC(34):COLOR 1,14 6 PRINT TAB(22)"ÎÏÒÈÌÈÇÀÖÈß ÇÀÊÐÅÏËÅÍÈß ÏÎÒÐÅÁÈÒÅËÅÉ"; 7 PRINT TAB(80)" ";:PRINT TAB(31)"ÇÀ ÏÎÑÒÀÂÙÈÊÀÌÈ"; 8 PRINT TAB(80)" ":DEFINT I-N 19 PRINT:COLOR 7,0,7':CLS 35 COLOR 1,6,14 IMAX=3 I=1 LOCATE 8,30,0:COLOR 25,4:PRINT"ÂÂÅÄÈÒÅ ÐÅÆÈÌ" 50 J=1 IF J=I THEN COLOR 4,11 ELSE COLOR 1,11 LOCATE 9,25,0:PRINT " ╔════════════════════════╗" LOCATE 10,25,0:PRINT"║ÂÂÎÄ È ÊÎÐÐÅÊÒÈÐÎÂÊÀ ║" LOCATE 11,25,0:PRINT"║ ÈÑÕÎÄÍÛÕ ÄÀÍÍÛÕ ║" LOCATE 12,25,0:PRINT"╚════════════════════════╝" J=2 IF J=I THEN COLOR 4,11 ELSE COLOR 1,11 LOCATE 13,25,0:PRINT"╔════════════════════════╗" LOCATE 14,25,0:PRINT"║ ÂÛÏÎËÍÅÍÈÅ ÐÀÑ×ÅÒΠ║" LOCATE 15,25,0:PRINT"║ ║" LOCATE 16,25,0:PRINT"╚════════════════════════╝" J=3 IF J=I THEN COLOR 4,11 ELSE COLOR 1,11 LOCATE 21,25,0:PRINT"╔════════════════════════╗" LOCATE 22,25,0:PRINT"║ ** ÂÛÕÎÄ ** ║" LOCATE 23,25,0:PRINT"╚════════════════════════╝" 95 AM$=INKEY$ IF LEN(AM$)=0 THEN 95 AM1$=RIGHT$(AM$,1) IF ASC(AM1$)=80 THEN I=I+1:GOTO 100 IF ASC(AM1$)=72 THEN I=I-1:GOTO 100 IF ASC(AM1$)=13 GOTO 110 GOTO 95 100 IF I>IMAX THEN I=1 IF I<1 THEN I=IMAX GOTO 50 110 COLOR 1,11 IF I=1 THEN SHELL "TRANW.EXE":GOTO 1 IF I=2 THEN SHELL"TRANR.EXE":GOTO 1 120 END
rem ÌÎÄÓËÜ ÏÐÎÃÐÀÌÌÛ ÂÂÎÄÀ ÄÀÍÍÛÕ 2 COLOR 7, 7, 15: CLS: LOCATE 10: PRINT: COLOR 0, 7, 15: DEFINT I-N 3 PRINT TAB(28); "Ç À Ä À × À T R A N ": PRINT TAB(27); " "; 4 COLOR 15, 0, 15: PRINT "ÊÀÔÅÄÐÀ";: COLOR 23, 5, 15: PRINT "*ÁÍÒÓ*"; 5 COLOR 15, 0, 15: PRINT " Î À Ï Ä Ä": PRINT: COLOR 1, 14 6 PRINT TAB(24); "ÇÀÄÀ×À ÇÀÊÐÅÏËÅÍÈß ÏÎÒÐÅÁÈÒÅËÅÉ"; 7 PRINT TAB(80); " ";: PRINT TAB(31); "ÇÀ ÏÎÑÒÀÂÙÈÊÀÌÈ"; 8 PRINT TAB(80); " ";: PRINT TAB(20); "*** ÂÂÎÄ, ÂÛÂÎÄ È ÊÎÐÐÅÊÒÈÐÎÂÊÀ "; 9 PRINT "ÄÀÍÍÛÕ ***";: PRINT TAB(80);" ";: COLOR 7, 10, 15 DELAY 3 19 PRINT: COLOR 7, 0, 7: CLS: GOTO 100 70 DIM A(M + 1), B(N + 1), C(M + 1, N + 1), AG$(M), BG$(N) 80 IF M3 = 1 THEN DIM D(M + 1, N + 1) 90 RETURN 100 FM$ = "####.#":IRAST=0 105 H0$ = "ÂÛ ÄÎÏÓÑÒÈËÈ ÎØÈÁÊÓ": H1$ = "ÇÀÏÀÑÛ Ó ÏÎÑÒÀÂÙÈÊÎÂ" 110 H2$ = "ÏÎÒÐÅÁÍÎÑÒÈ Ó ÏÎÒÐÅÁÈÒÅËÅÉ" 120 H3$ = "ÑÒÎÈÌÎÑÒÈ(ÐÀÑÑÒÎßÍÈß,ÂÐÅÌß) ÏÅÐÅÂÎÇÊÈ ÅÄÈÍÈÖÛ ÃÐÓÇÀ" 130 H4$ = "ÏÎÑÒ. ÏÎÒÐÅÁÈÒÅËÈ" 140 H5$ = "ÎÃÐÀÍÈ×ÅÍÈß ÍÀ ÐÀÇÌÅÐ ÊÎÐÐÅÑÏÎÍÄÅÍÖÈÉ" 150 H6$ = "ÌÅÆÄÓ ÏÎÑÒÀÂÙÈÊÀÌÈ È ÏÎÒÐÅÁÈÒÅËßÌÈ": H7$ = "ÊÎÐÐÅÊÒÈÐÎÂÀÒÜ" 160 H8$ = "ÈÑÕÎÄÍÛÅ ÄÀÍÍÛÅ" 170 H9$ = "×ÅÐÅÇ ÇÀÏßÒÓÞ ÏÎÐßÄÊÎÂÛÅ ÍÎÌÅÐÀ|(ÈÍÄÅÊÑÛ) ÏÎÑÒÀÂÙÈÊÀ È" 180 P0$ = "ÏÎÒÐÅÁÈÒÅËß ÄËß ÊÎÒÎÐÛÕ ÒÐÅÁÓÅÒÑß ÊÎÐÐÅÊÒÈÐÎÂÊÀ" 190 P1$ = "ÏÎÑËÅÄÎÂÀÒÅËÜÍÎ ÑÎÊÐÀÙÅÍ.ÍÀÈÌÅÍÎÂÀÍÈß(ÊÎÄÛ)" 200 P2$ = "ÏÎÐßÄÊÎÂÛÉ ÍÎÌÅÐ (ÈÍÄÅÊÑ) ÏÓÍÊÒÀ (Ñ×ÈÒÀß Ñ ÅÄÈÍÈÖÛ) ÄËß" 210 P3$ = "ÊÎÒÎÐÎÃÎ ÒÐÅÁÓÅÒÑß ÊÎÐÐÅÊÒÈÐÎÂÊÀ" 220 P4$ = "ÍÎÂÀß ÂÅËÈ×ÈÍÀ ": P5$ = " ÁÓÄÅÒ ÊÎÐÐÅÊÒÈÐÎÂÀÒÜÑß " 225 P6$ = " ÊÎÐÐÅÊÒÈÐÎÂÀÒÜ? ÄÀ - 1, ÍÅÒ - 0" 226 P7$ = "< ÓÊÀÆÈÒÅ ÑÏÅÖÈÔÈÊÀÖÈÞ ÔÀÉËÀ ÈÑÕÎÄÍÛÕ ÄÀÍÍÛÕ" 227 P8$ = " ×ÈÑËÎ ÏÎÑÒÀÂÙÈÊΠ": P9$ = " ×ÈÑËÎ ÏÎÒÐÅÁÈÒÅËÅÉ " 228 S0$ = " ÍÀËÈ×ÈÅ ÎÃÐÀÍÈ×ÅÍÈÉ ÍÀ ÐÀÇÌÅÐ ÊÎÐÐÅÑÏÎÍÄÅÍÖÈÉ(ÄÀ- 1,ÍÅÒ- 0) " 230 PRINT "ÂÂÅÄÅÍÛ ËÈ ÏÎËÍÛÅ "; H8$; ".ÄÀ- 1,ÍÅÒ- 0";: INPUT M0 232 IF M0 = 0 THEN 820 233 PRINT: PRINT P7$;: INPUT FAILW$ 235 OPEN "I", #1, FAILW$ 237 INPUT #1, M, N, M3 240 GOSUB 70 244 FOR I = 1 TO M: INPUT #1, AG$(I), A(I): NEXT I 248 FOR J = 1 TO N: INPUT #1, BG$(J), B(J): NEXT J 252 FOR I = 1 TO M: FOR J = 1 TO N: INPUT #1, C(I, J) 253 NEXT J: NEXT I 254 IF M3 = 0 THEN 260 258 FOR I = 1 TO M: FOR J = 1 TO N: INPUT #1, D(I, J) 259 NEXT J: NEXT I 260 CLOSE #1 340 MN = M: NN = N 350 PRINT TAB(10); H8$: PRINT TAB(5); H1$ 360 PRINT " I ";: FOR I = 1 TO MN: PRINT TAB(6 * I); AG$(I);: NEXT I: PRINT 370 PRINT "Q(I)";: FOR I = 1 TO MN: PRINT TAB(6 * I); USING FM$; A(I);: NEXT I: PRINT 380 PRINT TAB(5); H2$ 390 PRINT " J ";: FOR J = 1 TO NN: PRINT TAB(6 * J); BG$(J);: NEXT J: PRINT 400 PRINT "Q(J)";: FOR J = 1 TO NN: PRINT TAB(6 * J); USING FM$; B(J);: NEXT J: PRINT 410 PRINT TAB(5); H3$: PRINT 420 PRINT H4$ 430 FOR J = 1 TO NN: PRINT TAB(6 * J); BG$(J);: NEXT J: PRINT 440 FOR I = 1 TO MN: PRINT AG$(I);: FOR J = 1 TO NN: PRINT TAB(6 * J); USING FM$; C(I, J); 450 NEXT J: PRINT: NEXT I: PRINT 460 IF M3 = 0 THEN 520 470 PRINT TAB(5); H5$: PRINT 480 PRINT H4$ 490 FOR J = 1 TO NN: PRINT TAB(6 * J); BG$(J);: NEXT J: PRINT 500 FOR I = 1 TO MN: PRINT AG$(I);: FOR J = 1 TO NN: PRINT TAB(6 * J); USING FM$; D(I, J); 510 NEXT J: PRINT: NEXT I: PRINT 520 COLOR 0, 7: PRINT H7$; " "; H8$; ". ÄÀ- 1,ÍÅÒ- 0";: COLOR 7, 0 530 INPUT M8 540 IF M0 = 0 AND M8 = 0 THEN 1020 550 IF M8 = 0 THEN 1100 560 M0 = 0 570 PRINT H7$; " "; H1$; ".ÄÀ- 1,ÍÅÒ- 0";: INPUT M5 580 IF M5 = 0 THEN 620 590 PRINT P2$: PRINT P3$; " ÇÀÏÀÑÀ";: INPUT NS 600 IF NS < 1 OR NS > M THEN PRINT H0$: BEEP: GOTO 590 605 PRINT P5$; USING FM$; "QA("; AG$(NS); ")"; P6$;: INPUT ME 606 IF ME = 0 THEN 570 610 PRINT P4$; " ÇÀÏÀÑÀ";: INPUT A(NS): GOTO 570 620 PRINT H7$; " "; H2$; ".ÄÀ- 1,ÍÅÒ- 0";: INPUT M6 630 IF M6 = 0 THEN 670 640 PRINT P2$: PRINT P3$; " ÏÎÒÐÅÁÍÎÑÒÈ";: INPUT JS 650 IF JS < 1 OR JS > M THEN PRINT H0$: BEEP: GOTO 640 655 PRINT P5$; USING FM$; "QB("; BG$(JS); ")"; P6$;: INPUT ME 656 IF ME = 0 THEN 620 660 PRINT P4$; " ÏÎÒÐÅÁÍÎÑÒÈ";: INPUT B(JS): GOTO 620 670 PRINT H7$; " "; H3$ 680 PRINT "C(I,J).ÄÀ- 1,ÍÅÒ- 0"; 690 INPUT M7: IF M7 = 0 THEN 750 700 PRINT H9$: PRINT P0$; " C(I,J)"; 710 INPUT NS, JS 720 IF NS < 1 OR JS < 1 OR NS > M OR JS > N THEN PRINT H0$: BEEP: GOTO 700 725 PRINT P5$; USING FM$; "C("; AG$(NS); ","; BG$(JS); ")"; P6$;: INPUT ME 726 IF ME = 0 THEN 670 730 PRINT P4$; " ÑÒÎÈÌÎÑÒÈ(ÐÀÑÒÎßÍÈß,ÂÐÅÌÅÍÈ)";: INPUT C(NS, JS) 740 GOTO 670 750 IF M3 = 0 THEN 350 760 PRINT H7$; " ÎÃÐÀÍÈ×ÅÍÈß D(I,J).ÄÀ- 1,ÍÅÒ- 0"; 770 INPUT M2: IF M2 = 0 THEN 350 780 PRINT H9$: PRINT P0$; " D(I,J)"; 790 INPUT NS, JS 800 IF NS < 1 OR JS < 1 OR NS > M OR JS > N THEN PRINT H0$: BEEP: GOTO 780 805 PRINT P5$; USING FM$; "D("; AG$(NS); ","; BG$(JS); ")"; P6$;: INPUT ME 806 IF ME = 0 THEN 760 810 PRINT P4$; " ÎÃÐÀÍÈ×ÅÍÈß";: INPUT D(NS, JS): GOTO 760 820 PRINT "ÈÌÅÅÒÑß ÔÀÉË Ñ ÊÐÀÒ×.ÐÀÑÑÒÎßÍÈÌÈ.ÍÅÒ - N,ÄÀ- Y";: AAP$ = INPUT$(1) IF AAP$ = "N" OR AAP$ = "N" OR AAP$ = "Ò" OR AAP$ = "Ò" THEN 825 rem PRINT "ÂÂÅÄÈÒÅ ÑÏÅÖÈÔÈÊÀÖÈÞ ÔÀÉËÀ Ñ ÊÐÀÒ×ÀÉØÈÌÈ ÐÀÑÑÒÎßÍÈÌÈ"; rem INPUT FAAA$ IRAST=1 PRINT S0$;: INPUT M3 OPEN "I", #1, "KRTRST.REZ": INPUT #1, N, AAA: M = N GOSUB 70 FOR I = 1 TO N INPUT #1, AG$(I): BG$(I) = AG$(I) FOR J = 1 TO N INPUT #1, C(I, J), AAA NEXT J NEXT I CLOSE #1 GOTO 890 825 PRINT:PRINT P8$;: INPUT M 830 PRINT P9$;: INPUT N 835 PRINT S0$;: INPUT M3 840 GOSUB 70 850 PRINT P1$; " ÏÎÑÒÀÂÙÈÊÎÂ" 860 FOR I = 1 TO M: PRINT I; "-ÃÎ";: INPUT AG$(I): NEXT I 870 PRINT P1$; " ÏÎÒÐÅÁÈÒÅËÅÉ" 880 FOR J = 1 TO N: PRINT J; "-ÃÎ";: INPUT BG$(J): NEXT J 890 PRINT H1$ 900 FOR I = 1 TO M: PRINT AG$(I);: INPUT A(I): NEXT I 910 PRINT H2$ 920 FOR J = 1 TO N: PRINT BG$(J);: INPUT B(J): NEXT J IF IRAST=1 THEN 960 930 PRINT H3$: PRINT H6$ 940 FOR I = 1 TO M: FOR J = 1 TO N: PRINT "C("; AG$(I); ","; BG$(J); ")"; 950 INPUT C(I, J): NEXT J: NEXT I 960 IF M3 = 0 THEN 1010 970 PRINT H5$: PRINT H6$ 980 FOR I = 1 TO M 985 FOR J = 1 TO N: PRINT "D("; AG$(I); ","; BG$(J); ")"; 988 IF A(I) = 0 OR B(J) = 0 THEN D(1, J) = 0: GOTO 990 990 INPUT D(I, J) 1000 NEXT J 1005 NEXT I 1010 GOTO 340 1020 PRINT: PRINT P7$;: INPUT FAILW$ 1022 OPEN "O", #1, FAILW$ 1025 WRITE #1, M, N, M3 1028 FOR I = 1 TO M: WRITE #1, AG$(I), A(I): NEXT I 1030 FOR J = 1 TO N: WRITE #1, BG$(J), B(J): NEXT J 1035 FOR I = 1 TO M: FOR J = 1 TO N: WRITE #1, C(I, J) 1040 NEXT J: NEXT I 1045 IF M3 = 0 THEN 1070 1050 FOR I = 1 TO MN: FOR J = 1 TO NN: WRITE #1, D(I, J) 1060 NEXT J: NEXT I 1070 CLOSE #1 1100 PRINT: INPUT " ÂÛÂÎÄÈÒÜ ÈÑÕÎÄÍÛÅ ÄÀÍÍÛÅ Â ÔÀÉË ÄËß ÏÅ×ÀÒÈ.ÄÀ - 1,ÍÅÒ - 0 "; INDI 1105 IF INDI = 0 THEN 1275 1110 OPEN"O",#4,"DANTRZAD.PRN" 1111 PRINT #4, TAB(5); H8$: PRINT #4, 1114 PRINT #4, TAB(5); P8$; M 1115 PRINT #4, TAB(5); P9$; N 1116 PRINT #4, TAB(5); S0$; M3 1118 PRINT #4, TAB(5); H1$ 1120 PRINT #4, " I ";: FOR I = 1 TO MN: PRINT #4, TAB(6 * I); AG$(I);: NEXT I: PRINT #4, 1130 PRINT #4,: PRINT #4, "Q(I)";: FOR I = 1 TO MN: PRINT #4, TAB(6 * I); USING FM$; A(I);: NEXT I 1140 PRINT #4,: PRINT #4, TAB(5); H2$ 1150 PRINT #4, " J ";: FOR J = 1 TO NN: PRINT #4, TAB(6 * J); BG$(J);: NEXT J: PRINT #4, 1160 PRINT #4,: PRINT #4, "Q(J)";: FOR J = 1 TO NN: PRINT #4, USING FM$; B(J);: NEXT J 1170 PRINT #4,: PRINT #4,: PRINT #4, TAB(5); H3$: PRINT #4, 1180 PRINT #4, H4$ 1190 FOR J = 1 TO NN: PRINT #4, TAB(6 * J); BG$(J);: NEXT J: PRINT #4,: PRINT #4, 1200 FOR I = 1 TO MN: PRINT #4, AG$(I);: FOR J = 1 TO NN: PRINT #4, USING FM$; C(I, J); 1210 NEXT J: PRINT #4,: NEXT I: PRINT #4,: PRINT #4, 1220 IF M3 = 0 THEN 1275 1230 PRINT #4, TAB(5); H5$: PRINT #4, 1240 PRINT #4, H4$ 1250 FOR J = 1 TO NN: PRINT #4, TAB(6 * J); BG$(J);: NEXT J: PRINT #4,: PRINT #4, 1260 FOR I = 1 TO MN: PRINT #4, AG$(I);: FOR J = 1 TO NN: PRINT #4, USING FM$; D(I, J); 1270 NEXT J: PRINT #4,: NEXT I: PRINT #4, 1272 CLOSE #4 1275 COLOR 25,5,15:PRINT " ÈÑÕÎÄÍÛÅ ÄÀÍÍÛÅ ÄËß ÐÀÑ×ÅÒÀ  ÔÀÉËÅ "FAILW$ 1276 PRINT " ÈÑÕÎÄÍÛÅ ÄÀÍÍÛÅ ÄËß ÂÛÂÎÄÀ ÍÀ ÏÅ×ÀÒÜ Â ÔÀÉËÅ DANTRZAD.PRN" 1277 BBB$=INKEY$ 1278 IF LEN(BBB$)=0 THEN 1277 1280 END
rem ÌÎÄÓËÜ ÏÐÎÃÐÀÌÌÛ ÂÛÏÎËÍÅÍÈß ÐÀÑ×ÅÒΠ2 COLOR 7,7,15:CLS:LOCATE 10:PRINT:COLOR 0,7,15:DEFINT I-N 3 PRINT TAB(28)"Ç À Ä À × À T R A N ":PRINT TAB(27)" "; 4 COLOR 15,0,15:PRINT"ÊÀÔÅÄÐÀ";:COLOR 23,5,15:PRINT"*ÁÍÒÓ*"; 5 COLOR 15,0,15:PRINT" Î À Ï Ä Ä":PRINT:COLOR 1,14 6 PRINT TAB(24)"ÇÀÄÀ×À ÇÀÊÐÅÏËÅÍÈß ÏÎÒÐÅÁÈÒÅËÅÉ"; 7 PRINT TAB(80)" ";:PRINT TAB(31)"ÇÀ ÏÎÑÒÀÂÙÈÊÀÌÈ"; 8 PRINT TAB(80)" ";:PRINT TAB(20)"***ÂÛÏÎËÍÅÍÈÅ ÐÀÑ×ÅÒÎÂ È ÂÛÂÎÄ ÐÅÇÓËÜÒÀÒÎÂ***"; 9 PRINT TAB(80)" ";:COLOR 7,10,15 19 PRINT:COLOR 7,0,7 60 GOTO 226 70 DIM A(M+1),B(N+1),C(M+1,N+1),AG$(M),BG$(N) 80 IF M3=1 THEN DIM D(M+1,N+1) 90 RETURN 226 P7$="< ÓÊÀÆÈÒÅ ÑÏÅÖÈÔÈÊÀÖÈÞ ÔÀÉËÀ ÈÑÕÎÄÍÛÕ ÄÀÍÍÛÕ" 228 PRINT:PRINT P7$:INPUT FAILW$ 250 OPEN"I",#1,FAILW$ 260 INPUT #1,M,N,M3 270 GOSUB 70 280 FOR I=1 TO M:INPUT #1,AG$(I),A(I):NEXT I 290 FOR J=1 TO N:INPUT #1,BG$(J),B(J):NEXT J 300 FOR I=1 TO M:FOR J=1 TO N:INPUT #1,C(I,J):NEXT J:NEXT I 310 IF M3=0 THEN 330 320 FOR I=1 TO M:FOR J=1 TO N:INPUT #1,D(I,J):NEXT J:NEXT I 330 CLOSE #1 340 MN=M:NN=N 1280 REM 1290 REM ÏÐÎÂÅÐÊÀ ÁÀËÀÍÑÀ 1300 AZ=0:FOR I=1 TO M:AZ=AZ+A(I):NEXT I 1310 BZ=0:FOR J=1 TO N:BZ=BZ+B(J):NEXT J 1320 IF AZ=BZ THEN 1380 1330 IF AZ>BZ THEN 1360 1340 M=M+1:A(M)=BZ-AZ:FOR J=1 TO N:C(M,J)=0:IF M3=1 THEN D(M,J)=1E+10 1350 NEXT J:GOTO 1380 1360 N=N+1:B(N)=AZ-BZ:FOR I=1 TO M:C(I,N)=0:IF M3=1 THEN D(I,N)=1E+10 1370 NEXT I 1380 DIM DYNAMIC DA(M),DB(N),IR(M),IC(N),JR(M),JC(N) 1390 DIM DYNAMIC U(M),V(N),IU(M),IV(N),IT(M+N),JT(M+N) 1400 DIM DYNAMIC X(M,N),IX(M,N),MM(M,N) 1410 IF M3=1 THEN DIM DYNAMIC CP(M,N),DK(M,N) 1420 IF M3=0 THEN 1440 1430 FOR I=1 TO M:FOR J=1 TO N:CP(I,J)=C(I,J):NEXT J:NEXT I 1440 FOR I=1 TO M:DA(I)=A(I):IR(I)=0:JR(I)=0:NEXT I 1450 FOR J=1 TO N:DB(J)=B(J):IC(J)=0:JC(J)=0:NEXT J 1460 J0=0:JT=0:MR=0 1470 REM ÏÎÈÑÊ ÌÈÍÈÌÀËÜÍÎÉ ÑÒÎÈÌÎÑÒÈ 1480 II=0:JJ=0:Y=1E+12 1490 FOR I=1 TO M 1500 IF IR(I)=1 THEN 1560 1510 FOR J=1 TO N 1520 IF IC(J)=1 THEN 1550 1530 IF C(I,J)>Y THEN 1550 1540 Y=C(I,J):II=I:JJ=J 1550 NEXT J 1560 NEXT I 1570 REM ÇÀÍÅÑÅÍÈÅ ÊÎÐÐÅÑÏÎÍÄÅÍÖÈÈ Â II È JJ 1580 IF DA(II)<=DB(JJ) THEN 1610 1590 X(II,JJ)=DB(JJ):IX(II,JJ)=1:DA(II)=DA(II)-DB(JJ):DB(JJ)=0 1600 IC(JJ)=1:J0=J0+1:JT=JT+1:GOTO 1640 1610 IF DA(II)=DB(JJ) AND MR=M-1 THEN 1590 1620 X(II,JJ)=DA(II):IX(II,JJ)=1 1630 DB(JJ)=DB(JJ)-DA(II):DA(II)=0:IR(II)=1:J0=J0+1:MR=MR+1 1640 JR(II)=JR(II)+1:JC(JJ)=JC(JJ)+1 1650 IF J0<M+N-1 THEN 1480 1660 MR=MR+1 1670 REM ÐÀÑ×ÅÒ ÏÎÒÅÍÖÈÀËΠÑÒÐÎÊ È ÑÒÎËÁÖΠ1680 FOR I=1 TO M:IU(I)=0:U(I)=0:NEXT I 1690 FOR J=1 TO N:IV(J)=0:V(J)=0:NEXT J 1700 KT=0:L=0 1710 FOR I=1 TO M 1720 IF JR(I)<KT THEN 1740 1730 KT=JR(I):L=I 1740 NEXT I 1750 U(L)=0:IU(L)=1:J0=1 1760 FOR J=1 TO N 1770 IF IX(L,J)=0 THEN 1790 1780 V(J)=C(L,J):IV(J)=1:J0=J0+1 1790 NEXT J 1800 FOR I=1 TO M:FOR J=1 TO N 1810 IF IX(I,J)=0 THEN 1880 1820 IF IU(I)=0 AND IV(J)=0 THEN 1880 1830 IF IU(I)=1 AND IV(J)=1 THEN 1880 1840 IF IU(I)=0 AND IV(J)=1 THEN 1870 1850 V(J)=C(I,J)-U(I):IV(J)=1:J0=J0+1 1860 GOTO 1880 1870 U(I)=C(I,J)-V(J):IU(I)=1:J0=J0+1 1880 NEXT J:NEXT I 1890 IF J0<>M+N THEN 1800 1900 REM ÏÎÈÑÊ ÌÈÍÈÌÀËÜÍÎÃÎ ÎÖÅÍÎ×ÍÎÃÎ ÏÀÐÀÌÅÒÐÀ 1910 DL=0:K=0:L=0 1920 FOR I=1 TO M:FOR J=1 TO N 1930 IF IX(I,J)=1 THEN 1960 1940 DT=C(I,J)-U(I)-V(J):IF DT>=DL THEN 1960 1950 DL=DT:K=I:L=J 1960 NEXT J:NEXT I 1970 IF ABS(DL)<=1E-06 THEN 2490 1980 REM 1990 PRINT:GOSUB 2660 2000 REM ÏÎÑÒÐÎÅÍÈÅ ÊÎÍÒÓÐÀ ÄËß ÏÅÐÅÕÎÄÀ Ê ÍÎÂÎÌÓ ÁÀÇÈÑÓ 2010 FOR I=1 TO M:IU(I)=0:NEXT I 2020 FOR J=1 TO N:IV(J)=0:NEXT J 2030 FOR I=1 TO M+N:IT(I)=0:JT(I)=0:NEXT I 2040 FOR I=1 TO M:FOR J=1 TO N 2050 MM(I,J)=0 2060 NEXT J:NEXT I 2070 KT=1:IP=0:IT(KT)=K:JT(KT)=L:MM(K,L)=1:IU(K)=1 2080 PRINT KT,K;L 2090 LR=O:LC=0:II=IT(KT):JJ=0 2100 FOR J=1 TO N 2110 IF LC=1 OR IX(II,J)=0 OR IV(J)=1 OR MM(II,J)=1 THEN 2150 2120 IF JC(J)=1 AND J=L THEN 2140 2130 IF JC(J)=1 THEN IP=1:GOTO 2150 2140 LC=1:JJ=J:IV(J)=1:J=N 2150 NEXT J 2160 IF JJ<>0 THEN 2190 2170 IF IP>0 THEN IP=0 2180 KT=KT-1:GOTO 2210 2190 KT=KT+1:IT(KT)=II:JT(KT)=JJ:MM(II,JJ)=1 2200 IF JT(KT)=L AND KT>2 THEN 2330 2210 LR=0:LC=0:II=0:JJ=JT(KT) 2220 FOR I=1 TO M 2230 IF LR=1 OR IX(I,JJ)=0 OR IU(I)=1 OR MM(I,JJ)=1 THEN 2260 2240 IF JR(I)=1 AND IP=0 THEN IP=1:GOTO 2260 2250 LR=1:II=I:IU(I)=1:I=M 2260 NEXT I 2270 IF II<>0 THEN 2300 2280 IF IP>0 THEN IP=0 2290 KT=KT-1:GOTO 2090 2300 KT=KT+1:IP=0:IT(KT)=II:JT(KT)=JJ:MM(II,JJ)=1 2310 GOTO 2090 2320 REM ÏÎËÓ×ÅÍÈÅ ÍÎÂÎÃÎ ÁÀÇÈÑÀ 2330 W=1E+10:LL=0:KK=0 2340 FOR I=2 TO KT STEP 2 2350 IF X(IT(I),JT(I))>=W THEN 2370 2360 W=X(IT(I),JT(I)):KK=IT(I):LL=JT(I) 2370 NEXT I:WW=-W 2380 FOR I=1 TO KT 2390 WW=WW*(-1) 2400 X(IT(I),JT(I))=X(IT(I),JT(I))+WW 2410 NEXT I 2420 IX(K,L)=1:IX(KK,LL)=0 2430 JR(K)=JR(K)+1:JR(KK)=JR(KK)-1 2440 JC(L)=JC(L)+1:JC(LL)=JC(LL)-1 2450 REM 2460 'PRINT"DL="DL;"W="W;"KT="KT;"KK="KK;"LL="LL 2470 PRINT"ÏÐÅÎÁÐÀÇÎÂÀÍÈÅ ÇÀÊÎÍ×ÅÍÎ ÓÑÏÅØÍÎ" 2480 GOTO 1680 2490 IF M3=0 THEN 2620 2500 M4=0:FOR I=1 TO M:FOR J=1 TO N 2510 IF C(I,J)>1E+09 THEN 2550 2520 IF X(I,J)<=D(I,J) THEN 2550 2530 DK(I,J)=D(I,J):A(I)=A(I)-D(I,J):B(J)=B(J)-D(I,J):M4=1 2540 C(I,J)=1E+10 2550 NEXT J:NEXT I 2560 IF M4=0 THEN 2580 2570 FOR I= 1 TO M:FOR J=1 TO N:X(I,J)=0:IX(I,J)=0:NEXT J:NEXT I:GOTO 1440 2580 FOR I= 1 TO M:FOR J=1 TO N:IF C(I,J)>1E+09 THEN X(I,J)=DK(I,J) 2590 NEXT J:NEXT I 2600 IF M3=0 THEN 2620 2610 FOR I=1 TO MN:FOR J=1 TO NN:C(I,J)=CP(I,J):NEXT J:NEXT I 2620 PRINT:PRINT"ÎÊÎÍ×ÀÒÅËÜÍÎÅ ÐÅØÅÍÈÅ" 2630 GOSUB 2660 2635 PRINT:PRINT" ÏÎÒÐÅÁÓÅÒÑß ÂÛÂÎÄ ÍÀ ÏÐÈÍÒÅÐ. ÄÀ - 1,ÍÅÒ - 0)" 2636 INPUT INDI:IF INDI=0 THEN 2860 2640 PRINT:PRINT" < ÇÀÄÀÉÒÅ ÑÏÅÖÈÔÈÊÀÖÈÞ ÔÀÉËÀ ÐÅÇÓËÜÒÀÒΠÐÀÑ×ÅÒÀ" 2650 INPUT FAILR$:OPEN "O",#1,FAILR$:GOTO 2750 2660 CC=0 2670 IF DL=0 THEN PRINT" I J","XIJ","CIJ","ÑÒÎÈÌÎÑÒÜ" 2680 FOR I=1 TO MN:FOR J=1 TO NN 2690 IF X(I,J)=0 THEN 2720 2700 PP=C(I,J)*X(I,J):CC=CC+PP 2710 IF KL=0 THEN PRINT AG$(I);TAB(6)BG$(J);TAB(15) USING "#####.#";X(I,J),C(I,J),PP 2720 NEXT J:NEXT I 2730 PRINT"ÖÅËÅÂÀß ÔÓÍÊÖÈß(ÎÁÙÈÅ ÇÀÒÐÀÒÛ) ";CC 2740 RETURN 2750 PRINT #1,:PRINT #1, TAB(5)"ÎÏÒÈÌÀËÜÍÛÉ ÏËÀÍ ÇÀÊÐÅÏËÅÍÈß ÏÎÒÐÅÁÈÒÅËÅÉ" 2760 PRINT #1,TAB(16)"ÇÀ ÏÎÑÒÀÂÙÈÊÀÌÈ":PRINT #1, 2770 PRINT #1, " ÏÓÍÊÒÛ ÐÀÇÌÅÐ ÑÒÎÈÌÎÑÒÜ ÑÒÎÈÌÎÑÒÜ" 2780 PRINT #1, " ÏÎÑÒÀÂÊÈ ÏÎÑÒÀÂÊÈ" 2790 PRINT #1, " I J XIJ CIJ" 2800 FOR I=1 TO MN:FOR J=1 TO NN 2810 IF X(I,J)=0 THEN 2840 2820 PP=C(I,J)*X(I,J) 2830 PRINT #1, AG$(I);TAB(6)BG$(J);TAB(11) USING "#######.###";X(I,J),C(I,J),PP 2840 NEXT J:NEXT I 2850 PRINT #1,"ÖÅËÅÂÀß ÔÓÍÊÖÈß(ÎÁÙÈÅ ÇÀÒÐÀÒÛ) ";CC 2855 CLOSE #1 2856 COLOR 25,5,15:PRINT "ÐÅÇÓËÜÒÀÒÛ ÐÀÑ×ÅÒÀ  ÔÀÉËÅ "FAILR$ 2857 BBB$=INKEY$ 2858 IF LEN(BBB$)=0 THEN 2857 2860 END
Ïîèñê ïî ñàéòó: |
Âñå ìàòåðèàëû ïðåäñòàâëåííûå íà ñàéòå èñêëþ÷èòåëüíî ñ öåëüþ îçíàêîìëåíèÿ ÷èòàòåëÿìè è íå ïðåñëåäóþò êîììåð÷åñêèõ öåëåé èëè íàðóøåíèå àâòîðñêèõ ïðàâ. Ñòóäàëë.Îðã (0.036 ñåê.) |