# Include <stdio. h> <br/> # include <string. h> <br/> int f [25]; // the first fish that can be caught in five minutes <br/> int CURF [25]; // currently, the number of fish caught in each lake <br/> int d [25]; // The number of fish caught in each five minutes <br/> int ans [25]; // The duration of each lake when the maximum number of fish can be caught <br/> int anstmp [25]; <br/> int T [25]; // time required to move from I to I + 1 <br/> int N; <br/> int times; // total fishing time <br/> int restimes; // total fishing time-time spent walking between lakes <br/> int fish; // maximum number of fish to be caught <br/> int fishtmp; <br/> int main () {<br/> while (scanf ("% d", & N )! = EOF & n! = 0) {<br/> scanf ("% d", ×); <br/> for (INT I = 0; I <n; I ++) <br/> scanf ("% d", & F [I]); <br/> for (INT I = 0; I <n; I ++) <br/> scanf ("% d", & D [I]); <br/> for (INT I = 1; I <n; I ++) <br/> scanf ("% d", & T [I]); <br/> T [0] = 0; <br/> times * = 12; <br/> restimes = 0; <br/> fish = 0; <br/> memset (ANS, 0, sizeof (ANS )); <br/> for (INT Len = 1; Len <= N; Len ++) {<br/> memcpy (CURF, F, sizeof (f )); <br/> memset (anstmp, 0, sizeof (anstmp); <br/> restimes + = T [Len-1]; <br/> fishtmp = 0; <br/> for (INT I = 1; I <= times-restimes; I ++) {<br/> int _ Maxi = 0; <br/> for (Int J = 1; j <Len; j ++) <br/> If (CURF [J]> CURF [_ Maxi]) <br/> _ Maxi = J; <br/> anstmp [_ Maxi] ++; <br/> fishtmp + = CURF [_ Maxi]; <br/> CURF [_ Maxi]-= d [_ Maxi]; <br/> If (CURF [_ Maxi] <0) <br/> CURF [_ Maxi] = 0; <br/>}< br/> If (fishtmp> fish) {<br/> fish = fishtmp; <br/> memcpy (ANS, anstmp, sizeof (anstmp); <br/>} else if (fishtmp = fish) {<br/> for (INT I = 0; I <Len; I ++) {<br/> If (ANS [I]> anstmp [I]) break; // if you forget this sentence, an error may occur when multiple solutions are implemented. wa3 times later, you will find that <br/> If (ANS [I] <anstmp [I]) {<br/> memcpy (ANS, anstmp, sizeof (anstmp); <br/> break; <br/>}< br/> printf ("% d", ANS [0] * 5 ); <br/> for (INT I = 1; I <n; I ++) <br/> printf (", % d", ANS [I] * 5 ); <br/> printf ("/nNumber of fish expected: % d/n", fish); <br/>}< br/> return 0; <br/>}< br/>