#include <stdio.h> #include <string.h> int f[25]; //第一个五分钟能钓到的鱼 int curF[25]; //目前各湖能钓到的鱼数 int d[25]; //每五分钟鱼量减少的数目 int ans[25]; //能钓到最大鱼数时各湖停留的时间 int ansTmp[25]; int t[25]; //从i走到i+1所需要的时间 int n; int times; //总的钓鱼时间 int resTimes; //总的钓鱼时间 - 行走于各湖之间的时间 int fish; //能钓的最大鱼数 int fishTmp; int main() { while(scanf("%d", &n) != EOF && n != 0) { scanf("%d", ×); for(int i = 0; i < n; i++) scanf("%d", &f[i]); for(int i = 0; i < n; i++) scanf("%d", &d[i]); for(int i = 1; i < n; i++) scanf("%d", &t[i]); t[0] = 0; times *= 12; resTimes = 0; fish = 0; memset(ans, 0, sizeof(ans)); for(int len = 1; len <= n; len++) { memcpy(curF, f, sizeof(f)); memset(ansTmp, 0, sizeof(ansTmp)); resTimes += t[len - 1]; fishTmp = 0; for(int i = 1; i <= times - resTimes; i++) { int _maxi = 0; for(int j = 1; j < len; j++) if(curF[j] > curF[_maxi]) _maxi = j; ansTmp[_maxi]++; fishTmp += curF[_maxi]; curF[_maxi] -= d[_maxi]; if(curF[_maxi] < 0) curF[_maxi] = 0; } if(fishTmp > fish) { fish = fishTmp; memcpy(ans, ansTmp, sizeof(ansTmp)); }else if(fishTmp == fish) { for(int i = 0; i < len; i++) { if(ans[i] > ansTmp[i]) break; //之前忘了这句,导致多解的时候可能出错,WA3次后发现 if(ans[i] < ansTmp[i]) { memcpy(ans, ansTmp, sizeof(ansTmp)); break; } } } } printf("%d", ans[0] * 5); for(int i = 1; i < n; i++) printf(", %d", ans[i] * 5); printf("/nNumber of fish expected: %d/n/n", fish); } return 0; }