-
Notifications
You must be signed in to change notification settings - Fork 0
/
Math_model.java
2273 lines (2266 loc) · 112 KB
/
Math_model.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
目录--------------------------------------------------------------------------
* 2020年全国大学生数学建模竞赛B题第一题
* 2020年全国大学生数学建模竞赛B题第二题
* 2020年全国大学生数学建模竞赛B题第三题
* 2020年全国大学生数学建模竞赛B题第四题
* 2020年全国大学生数学建模竞赛B题第五题
* 2020年全国大学生数学建模竞赛B题第六题
*
* 2021年美国大学生数学建模竞赛C题
* 数据7/3分训练集测试机
*/
/**2020年全国大学生数学建模竞赛B题第一题**/
//public class Math_model {
// public static void main(String[] args) {
// int heavy = 1200; /**负重上线1200kg**/
// int day = 30; /**时间30天**/
// int money = 10000; /**初始资金10000元**/
// int earn = 1000; /**基础收益1000元**/
// int[] water = {3,5}; /**水每箱质量3kg、每箱基准价格5元**/
// int[] food = {2,10}; /**食物每箱质量2kg、每箱基准价格10元**/
// int[] sun = {5,7}; /**晴天水消耗5箱,食物消耗7箱**/
// int[] hot = {8,6}; /**高温水消耗8箱,食物消耗6箱**/
// int[] sand = {10,10}; /**沙暴水消耗10箱,食物消耗10箱**/
// int[] weather = {0,2,2,1,3,1,2,3,1,2,2,3,2,1,2,2,2,3,3,2,2,1,1,2,1,3,2,1,1,2,2};
// /**天气情况:1代表晴朗、2代表高温、3代表沙暴**/
// /**路线思路:尽可能多的在矿洞里面呆,尽可能进入矿洞的次数最少。**/
// /**为达到目标,在进矿洞之前物资补给充分,出矿洞后物资保留去到村庄即可**/
// int[] resources_begin = {0,0};
// int go_day = 1;
// int[] money_tony=new int[31];
// int[] water_tony=new int[31];
// int[] food_tony=new int[31];
// int money_remain=money-(245*5+211*10);
// int water_remain=245;
// int food_remain=211;
// money_tony[0]=money_remain;
// water_tony[0]=water_remain;
// food_tony[0]=food_remain;
// System.out.println("开始剩余资金:"+money_remain);
// System.out.println("开始剩余水量: "+water_remain + "开始剩余食物量:"+food_remain);
// int begin_village = 6; /**在最短路Matlab算的为6**/
// for (;go_day<=begin_village;go_day++) {
// if (weather[go_day] == 1) {
// resources_begin[0] += sun[0]*2*water[0];
// resources_begin[1] += sun[1]*2*food[0];
// water_tony[go_day]=water_tony[go_day-1]-sun[0]*2;
// food_tony[go_day]=food_tony[go_day-1]-sun[1]*2;
// } else if (weather[go_day] == 2) {
// resources_begin[0] += hot[0]*2*water[0];
// resources_begin[1] += hot[1]*2*food[0];
// water_tony[go_day]=water_tony[go_day-1]-hot[0]*2;
// food_tony[go_day]=food_tony[go_day-1]-hot[1]*2;
// } else if (weather[go_day] == 3) {
// resources_begin[0] += sand[0]*water[0];
// resources_begin[1] += sand[1]*food[0];
// water_tony[go_day]=water_tony[go_day-1]-sand[0];
// food_tony[go_day]=food_tony[go_day-1]-sand[1];
// begin_village++;
// }
// money_tony[go_day]=money_tony[go_day-1];
// } /**根据沙暴停一天原理,算的在第八天到村庄**/
// System.out.println("到达村庄的天数:"+(go_day-1));
// System.out.println("到达村庄需要物资:"+resources_begin[0]+" "+resources_begin[1]);
// System.out.println("到达村庄需要物资箱数:"+resources_begin[0]/water[0]+" "+resources_begin[1]/food[0]);
//
// water_tony[go_day-1]=water_remain;
// food_tony[go_day-1]=food_remain;
//
// money_tony[go_day-1]=money_tony[go_day-1]-resources_begin[0]/water[0]*water[1]*2-resources_begin[1]/food[0]*food[1]*2;
//
// /**挖矿需要满资源分配**/
// int[] resources_mine = {0,0};
// int[] resources_mine_before = {0,0};
// int[] mine_village_first_resources = {0,0};
// int[] mine_village_first_resources_before = {0,0};
//
// /**预测天数**/
// int go_day_predict=0;
//
// /**先到达矿洞**/
// int village_mine_first_day=go_day+2; /**最短路需要为2**/
// for (;go_day<village_mine_first_day;go_day++){
// if (weather[go_day]==1){
// resources_mine[0]+=sun[0]*2*water[0];
// resources_mine[1]+=sun[1]*2*food[0];
// water_tony[go_day]=water_tony[go_day-1]-sun[0]*2;
// food_tony[go_day]=food_tony[go_day-1]-sun[1]*2;
// } else if (weather[go_day]==2){
// resources_mine[0]+=hot[0]*2*water[0];
// resources_mine[1]+=hot[1]*2*food[0];
// water_tony[go_day]=water_tony[go_day-1]-hot[0]*2;
// food_tony[go_day]=food_tony[go_day-1]-hot[1]*2;
// } else if (weather[go_day]==3){
// resources_mine[0]+=sand[0]*water[0];
// resources_mine[1]+=sand[1]*food[0];
// water_tony[go_day]=water_tony[go_day-1]-sand[0];
// food_tony[go_day]=food_tony[go_day-1]-sand[1];
// village_mine_first_day++;
// }
// money_tony[go_day]=money_tony[go_day-1];
// }
//
// /**确定安全情况下的最大挖矿时间**/
// while (resources_mine[0]+resources_mine[1]+mine_village_first_resources[0]+mine_village_first_resources[1]<=heavy){
// /**挖矿**/
// if (weather[go_day]==1){
// resources_mine[0]+=sun[0]*3*water[0];
// resources_mine[1]+=sun[1]*3*food[0];
// } else if (weather[go_day]==2){
// resources_mine[0]+=hot[0]*3*water[0];
// resources_mine[1]+=hot[1]*3*food[0];
// } else if (weather[go_day]==3){
// resources_mine[0]+=sand[0]*3*water[0];
// resources_mine[1]+=sand[1]*3*food[0];
// }
//
// /**回村**/
// /**初始化离开矿洞回村需要资源**/
// mine_village_first_resources[0]=0;
// mine_village_first_resources[1]=0;
//
// go_day_predict=go_day+1;
// int mine_village_first_day = go_day_predict+2; /**最短路需要为2**/
// for (;go_day_predict<mine_village_first_day;go_day_predict++) {
// if (weather[go_day_predict] == 1) {
// mine_village_first_resources[0] += sun[0]*2*water[0];
// mine_village_first_resources[1] += sun[1]*2*food[0];
// } else if (weather[go_day_predict] == 2) {
// mine_village_first_resources[0] += hot[0]*2*water[0];
// mine_village_first_resources[1] += hot[1]*2*food[0];
// } else if (weather[go_day_predict] == 3) {
// mine_village_first_resources[0] += sand[0]*water[0];
// mine_village_first_resources[1] += sand[1]*food[0];
// mine_village_first_day++;
// }
// }
//
// /**前一天数据储存**/
// if (resources_mine[0]+resources_mine[1]+mine_village_first_resources[0]+mine_village_first_resources[1]<=heavy){
// resources_mine_before[0]=resources_mine[0];
// resources_mine_before[1]=resources_mine[1];
// mine_village_first_resources_before[0]=mine_village_first_resources[0];
// mine_village_first_resources_before[1]=mine_village_first_resources[1];
// if (weather[go_day]==1){
// water_tony[go_day]=water_tony[go_day-1]-sun[0]*3;
// food_tony[go_day]=food_tony[go_day-1]-sun[1]*3;
// } else if (weather[go_day]==2){
// water_tony[go_day]=water_tony[go_day-1]-hot[0]*3;
// food_tony[go_day]=food_tony[go_day-1]-hot[1]*3;
// } else if (weather[go_day]==3){
// water_tony[go_day]=water_tony[go_day-1]-sand[0]*3;
// food_tony[go_day]=food_tony[go_day-1]-sand[1]*3;
// }
// money_tony[go_day]=money_tony[go_day-1]+earn;
// go_day_predict=go_day+1;
// mine_village_first_day = go_day_predict+2; /**最短路需要为2**/
// for (;go_day_predict<mine_village_first_day;go_day_predict++) {
// if (weather[go_day_predict] == 1) {
// water_tony[go_day_predict]=water_tony[go_day_predict-1]-sun[0]*2;
// food_tony[go_day_predict]=food_tony[go_day_predict-1]-sun[1]*2;
// } else if (weather[go_day_predict] == 2) {
// water_tony[go_day_predict]=water_tony[go_day_predict-1]-hot[0]*2;
// food_tony[go_day_predict]=food_tony[go_day_predict-1]-hot[1]*2;
// } else if (weather[go_day_predict] == 3) {
// water_tony[go_day_predict]=water_tony[go_day_predict-1]-sand[0];
// food_tony[go_day_predict]=food_tony[go_day_predict-1]-sand[1];
// mine_village_first_day++;
// }
// money_tony[go_day_predict]=money_tony[go_day_predict-1];
// }
// go_day++;
// }
// }
// System.out.println("挖矿最后一天时间:"+(go_day-1));
// System.out.println("回到村庄天数:"+(go_day_predict-2));
// System.out.println("水和食物分配:"+(resources_mine_before[0]+mine_village_first_resources_before[0])+" "+(resources_mine_before[1]+mine_village_first_resources_before[1]));
// System.out.println("水和食物分配(箱数):"+(resources_mine_before[0]+mine_village_first_resources_before[0])/water[0]+" "+(resources_mine_before[1]+mine_village_first_resources_before[1])/food[0]);
//
//// for (int i=0;i<30;i++){
//// System.out.print(water_tony[i]+" ");
//// }
//
// /**此刻如果回村庄补给后再去挖矿**/
// go_day = go_day_predict-1;
// int[] resources_mine__two = {0,0};
//
// water_tony[go_day-1]=136;
// food_tony[go_day-1]=142;
//
// money_tony[go_day-1]=money_tony[go_day-1]-136*water[1]*2-142*food[1]*2;
//
// /**Matlab计算村庄回终点的最短路为3**/
// /**Matlab计算矿洞回村庄的最短路为2**/
// /**Matlab计算矿洞回终点的最短路为5**/
// /**故我们可以挖矿的时间为截止到25天**/
//
// /**第二次去矿洞**/
// int village_mine_second_day=go_day+2;
// for (;go_day<village_mine_second_day;go_day++){
// if (weather[go_day]==1){
// resources_mine__two[0]+=sun[0]*2*water[0];
// resources_mine__two[1]+=sun[1]*2*food[0];
// water_tony[go_day]=water_tony[go_day-1]-sun[0]*2;
// food_tony[go_day]=food_tony[go_day-1]-sun[1]*2;
// } else if (weather[go_day]==2){
// resources_mine__two[0]+=hot[0]*2*water[0];
// resources_mine__two[1]+=hot[1]*2*food[0];
// water_tony[go_day]=water_tony[go_day-1]-hot[0]*2;
// food_tony[go_day]=food_tony[go_day-1]-hot[1]*2;
// } else if (weather[go_day]==3){
// resources_mine__two[0]+=sand[0]*water[0];
// resources_mine__two[1]+=sand[1]*food[0];
// water_tony[go_day]=water_tony[go_day-1]-sand[0];
// food_tony[go_day]=food_tony[go_day-1]-sand[1];
// village_mine_second_day++;
// }
// money_tony[go_day]=money_tony[go_day-1];
// }
//
// /**开始第二次挖矿**/
// for (;go_day<=day-5;go_day++){
// if (weather[go_day]==1){
// resources_mine__two[0]+=sun[0]*3*water[0];
// resources_mine__two[1]+=sun[1]*3*food[0];
// water_tony[go_day]=water_tony[go_day-1]-sun[0]*3;
// food_tony[go_day]=food_tony[go_day-1]-sun[1]*3;
// } else if (weather[go_day]==2){
// resources_mine__two[0]+=hot[0]*3*water[0];
// resources_mine__two[1]+=hot[1]*3*food[0];
// water_tony[go_day]=water_tony[go_day-1]-hot[0]*3;
// food_tony[go_day]=food_tony[go_day-1]-hot[1]*3;
// } else if (weather[go_day]==3){
// resources_mine__two[0]+=sand[0]*3*water[0];
// resources_mine__two[1]+=sand[1]*3*food[0];
// water_tony[go_day]=water_tony[go_day-1]-sand[0]*3;
// food_tony[go_day]=food_tony[go_day-1]-sand[1]*3;
// }
// money_tony[go_day]=money_tony[go_day-1]+earn;
// }
//
// /**矿洞回村庄**/
// int mine_village_second_day=go_day+2;
// for (;go_day<mine_village_second_day;go_day++){
// if (weather[go_day]==1){
// resources_mine__two[0]+=sun[0]*2*water[0];
// resources_mine__two[1]+=sun[1]*2*food[0];
// water_tony[go_day]=water_tony[go_day-1]-sun[0]*2;
// food_tony[go_day]=food_tony[go_day-1]-sun[1]*2;
// } else if (weather[go_day]==2){
// resources_mine__two[0]+=hot[0]*2*water[0];
// resources_mine__two[1]+=hot[1]*2*food[0];
// water_tony[go_day]=water_tony[go_day-1]-hot[0]*2;
// food_tony[go_day]=food_tony[go_day-1]-hot[1]*2;
// } else if (weather[go_day]==3){
// resources_mine__two[0]+=sand[0]*water[0];
// resources_mine__two[1]+=sand[1]*food[0];
// water_tony[go_day]=water_tony[go_day-1]-sand[0];
// food_tony[go_day]=food_tony[go_day-1]-sand[1];
// mine_village_second_day++;
// }
// money_tony[go_day]=money_tony[go_day-1];
// }
//
// System.out.println("第二次挖矿水和食物的分配:"+resources_mine__two[0]+" "+resources_mine__two[1]);
// System.out.println("第二次挖矿水和食物分配(箱数):"+resources_mine__two[0]/water[0]+" "+resources_mine__two[1]/food[0]);
//
// water_tony[go_day-1]= 42;
// food_tony[go_day-1]= 38;
//
// money_tony[go_day-1]=money_tony[go_day-1]-42*water[1]*2-38*food[1]*2;
//
// /**村庄回终点**/
// int[] village_end_resources = {0,0};
// for (;go_day<=day;go_day++){
// if (weather[go_day]==1){
// village_end_resources[0]+=sun[0]*2*water[0];
// village_end_resources[1]+=sun[1]*2*food[0];
// water_tony[go_day]=water_tony[go_day-1]-sun[0]*2;
// food_tony[go_day]=food_tony[go_day-1]-sun[1]*2;
// } else if (weather[go_day]==2){
// village_end_resources[0]+=hot[0]*2*water[0];
// village_end_resources[1]+=hot[1]*2*food[0];
// water_tony[go_day]=water_tony[go_day-1]-hot[0]*2;
// food_tony[go_day]=food_tony[go_day-1]-hot[1]*2;
// } else if (weather[go_day]==3){
// village_end_resources[0]+=sand[0]*water[0];
// village_end_resources[1]+=sand[1]*food[0];
// water_tony[go_day]=water_tony[go_day-1]-sand[0];
// food_tony[go_day]=food_tony[go_day-1]-sand[1];
// }
// money_tony[go_day]=money_tony[go_day-1];
// }
// System.out.println("村庄回终点需要的水和食物的分配:"+village_end_resources[0]+" "+village_end_resources[1]);
// System.out.println("村庄回终点需要的水和食物分配(箱数):"+village_end_resources[0]/water[0]+" "+village_end_resources[1]/food[0]);
// System.out.print("每天剩余水的量:");
// for (int i=0;i<=30;i++) {
// System.out.print(water_tony[i]+" ");
// }
// System.out.println("");
// System.out.print("每天剩余食物的量:");
// for (int i=0;i<=30;i++) {
// System.out.print(food_tony[i]+" ");
// }
// System.out.println("");
// System.out.print("每天剩余钱的量:");
// for (int i=0;i<=30;i++){
// System.out.print(money_tony[i]+" ");
// }
// }
//}
/**2020年全国大学生数学建模竞赛B题第二题**/
//public class Math_model {
// public static void main(String[] args) {
// int heavy = 1200; /**负重上线1200kg**/
// int day = 30; /**时间30天**/
// int money = 10000; /**初始资金10000元**/
// int earn = 1000; /**基础收益1000元**/
// int[] water = {3,5}; /**水每箱质量3kg、每箱基准价格5元**/
// int[] food = {2,10}; /**食物每箱质量2kg、每箱基准价格10元**/
// int[] sun = {5,7}; /**晴天水消耗5箱,食物消耗7箱**/
// int[] hot = {8,6}; /**高温水消耗8箱,食物消耗6箱**/
// int[] sand = {10,10}; /**沙暴水消耗10箱,食物消耗10箱**/
// int[] weather = {0,2,2,1,3,1,2,3,1,2,2,3,2,1,2,2,2,3,3,2,2,1,1,2,1,3,2,1,1,2,2};
// /**天气情况:1代表晴朗、2代表高温、3代表沙暴**/
// /**路线思路:尽可能多的在矿洞里面呆,尽可能进入矿洞的次数最少。**/
// /**为达到目标,在进矿洞之前物资补给充分,出矿洞后物资保留能去到村庄即可**/
//
// int[] resources_begin = {0,0}; /**从开始到第一个村庄的资源收集**/
// int go_day = 1; /**从第一天开始**/
// int[] money_tony=new int[31]; /**记录每天钱、水、食物剩余**/
// int[] water_tony=new int[31];
// int[] food_tony=new int[31];
// int money_remain=money-(246*5+228*10); /**根据后面资源计算设定初始资源最优购买**/
// int water_remain=246;
// int food_remain=228;
// money_tony[0]=money_remain; /**设置起点物资携带**/
// water_tony[0]=water_remain;
// food_tony[0]=food_remain;
// System.out.println("开始剩余资金:"+money_remain);
// System.out.println("开始剩余水量:"+water_remain+" "+ "开始剩余食物量:"+food_remain);
//
// /**前往最近的村庄**/
// /**通过最短路可知,前往最短路中的最短路的村庄是村庄1**/
// int begin_village = 8; /**在Matlab算的最短路为8**/
// /**for的if、else if三件套为对天气的分类讨论**/
// for (;go_day<=begin_village;go_day++) {
// if (weather[go_day] == 1) {
// resources_begin[0] += sun[0]*2*water[0]; /**资源预计消耗计算(重量)**/
// resources_begin[1] += sun[1]*2*food[0];
// water_tony[go_day]=water_tony[go_day-1]-sun[0]*2; /**物资剩余记录(箱数)**/
// food_tony[go_day]=food_tony[go_day-1]-sun[1]*2;
// } else if (weather[go_day] == 2) {
// resources_begin[0] += hot[0]*2*water[0];
// resources_begin[1] += hot[1]*2*food[0];
// water_tony[go_day]=water_tony[go_day-1]-hot[0]*2;
// food_tony[go_day]=food_tony[go_day-1]-hot[1]*2;
// } else if (weather[go_day] == 3) {
// resources_begin[0] += sand[0]*water[0];
// resources_begin[1] += sand[1]*food[0];
// water_tony[go_day]=water_tony[go_day-1]-sand[0];
// food_tony[go_day]=food_tony[go_day-1]-sand[1];
// begin_village++;
// }
// money_tony[go_day]=money_tony[go_day-1];
// } /**算的在第10天到村庄,根据沙暴停一天原理,同样也要10天,说明计算正确**/
// /**for循环后、go_day为下一天——11天,故算到达村庄的天数为go_day-1**/
// System.out.println("到达村庄的天数:"+(go_day-1));
// System.out.println("到达村庄需要物资:"+resources_begin[0]+" "+resources_begin[1]);
// System.out.println("到达村庄需要物资箱数:"+resources_begin[0]/water[0]+" "+resources_begin[1]/food[0]);
//
// /**因为到达当天即可购买物资,所以第10天物资剩余记录会直接更新**/
// water_tony[go_day-1]=water_remain;
// food_tony[go_day-1]=food_remain;
// money_tony[go_day-1]=money_tony[go_day-1]-resources_begin[0]/water[0]*water[1]*2-resources_begin[1]/food[0]*food[1]*2;
//
// /**此处由两个选择,1:选择最近的挖矿点,路程消耗少,可以有更多资源以及时间放在挖矿上**/
// /**2:选择较远挖矿点,路程消耗较大,但是对于最终操作离终点近了一步**/
// /**根据后期时间对比,可以发现我们存在两个进矿操作,故第一次选择较近的矿洞为最优解**/
// /**可以在第二次进洞时分类讨论**/
//
// /**挖矿需要满资源分配**/
// int[] resources_mine = {0,0}; /**挖矿资源记录**/
// int[] resources_mine_before = {0,0}; /**前一天挖矿资源记录**/
// int[] mine_village_first_resources = {0,0}; /**预计回村需要资源记录**/
// int[] mine_village_first_resources_before = {0,0}; /**预计前一天回村需要资源记录**/
// int go_day_predict=0; /**预测天数**/
// /**先到达矿洞**/
// int village_mine_first_day=go_day+1; /**最短路需要为1**/
// for (;go_day<village_mine_first_day;go_day++){
// if (weather[go_day]==1){
// resources_mine[0]+=sun[0]*2*water[0]; /**到达矿洞资源记录**/
// resources_mine[1]+=sun[1]*2*food[0];
// water_tony[go_day]=water_tony[go_day-1]-sun[0]*2; /**到达矿洞剩余物资记录**/
// food_tony[go_day]=food_tony[go_day-1]-sun[1]*2;
// } else if (weather[go_day]==2){
// resources_mine[0]+=hot[0]*2*water[0];
// resources_mine[1]+=hot[1]*2*food[0];
// water_tony[go_day]=water_tony[go_day-1]-hot[0]*2;
// food_tony[go_day]=food_tony[go_day-1]-hot[1]*2;
// } else if (weather[go_day]==3){
// resources_mine[0]+=sand[0]*water[0];
// resources_mine[1]+=sand[1]*food[0];
// water_tony[go_day]=water_tony[go_day-1]-sand[0];
// food_tony[go_day]=food_tony[go_day-1]-sand[1];
// village_mine_first_day++;
// }
// money_tony[go_day]=money_tony[go_day-1];
// }
//
// System.out.println("进矿时间:"+(go_day-1));
//
// /**确定安全情况下的最大挖矿时间**/
// while (resources_mine[0]+resources_mine[1]+mine_village_first_resources[0]+mine_village_first_resources[1]<=heavy){
// /**挖矿**/
// if (weather[go_day]==1){
// resources_mine[0]+=sun[0]*3*water[0]; /**挖矿资源记录**/
// resources_mine[1]+=sun[1]*3*food[0];
// } else if (weather[go_day]==2){
// resources_mine[0]+=hot[0]*3*water[0];
// resources_mine[1]+=hot[1]*3*food[0];
// } else if (weather[go_day]==3){
// resources_mine[0]+=sand[0]*3*water[0];
// resources_mine[1]+=sand[1]*3*food[0];
// }
//
// /**回村**/
// /**初始化离开矿洞回村需要资源**/
// mine_village_first_resources[0]=0;
// mine_village_first_resources[1]=0;
//
// go_day_predict=go_day+1; /**预计下一天回村**/
// int mine_village_first_day = go_day_predict+1; /**最短路需要为1**/
// for (;go_day_predict<mine_village_first_day;go_day_predict++) {
// if (weather[go_day_predict] == 1) {
// mine_village_first_resources[0] += sun[0]*2*water[0]; /**回村资源记录**/
// mine_village_first_resources[1] += sun[1]*2*food[0];
// } else if (weather[go_day_predict] == 2) {
// mine_village_first_resources[0] += hot[0]*2*water[0];
// mine_village_first_resources[1] += hot[1]*2*food[0];
// } else if (weather[go_day_predict] == 3) {
// mine_village_first_resources[0] += sand[0]*water[0];
// mine_village_first_resources[1] += sand[1]*food[0];
// mine_village_first_day++;
// }
// }
// /**前一天数据储存**/
// if (resources_mine[0]+resources_mine[1]+mine_village_first_resources[0]+mine_village_first_resources[1]<=heavy){
// /**如果没超载,则储存更新去矿+挖矿总资源记录、回村总资源记录**/
// resources_mine_before[0]=resources_mine[0];
// resources_mine_before[1]=resources_mine[1];
// mine_village_first_resources_before[0]=mine_village_first_resources[0];
// mine_village_first_resources_before[1]=mine_village_first_resources[1];
// /**在负重范围内,同时记录更新剩余物资数**/
// if (weather[go_day]==1){
// water_tony[go_day]=water_tony[go_day-1]-sun[0]*3;
// food_tony[go_day]=food_tony[go_day-1]-sun[1]*3;
// } else if (weather[go_day]==2){
// water_tony[go_day]=water_tony[go_day-1]-hot[0]*3;
// food_tony[go_day]=food_tony[go_day-1]-hot[1]*3;
// } else if (weather[go_day]==3){
// water_tony[go_day]=water_tony[go_day-1]-sand[0]*3;
// food_tony[go_day]=food_tony[go_day-1]-sand[1]*3;
// }
// money_tony[go_day]=money_tony[go_day-1]+earn;
// /**预测下一天回村,储存更新回村时间剩余物资数**/
// go_day_predict=go_day+1;
// mine_village_first_day = go_day_predict+1; /**最短路需要为1**/
// for (;go_day_predict<mine_village_first_day;go_day_predict++) {
// if (weather[go_day_predict] == 1) {
// water_tony[go_day_predict]=water_tony[go_day_predict-1]-sun[0]*2;
// food_tony[go_day_predict]=food_tony[go_day_predict-1]-sun[1]*2;
// } else if (weather[go_day_predict] == 2) {
// water_tony[go_day_predict]=water_tony[go_day_predict-1]-hot[0]*2;
// food_tony[go_day_predict]=food_tony[go_day_predict-1]-hot[1]*2;
// } else if (weather[go_day_predict] == 3) {
// water_tony[go_day_predict]=water_tony[go_day_predict-1]-sand[0];
// food_tony[go_day_predict]=food_tony[go_day_predict-1]-sand[1];
// mine_village_first_day++;
// }
// money_tony[go_day_predict]=money_tony[go_day_predict-1];
// }
// /**若负重达标,则go_day+1,最终go_day为离开矿洞的时间**/
// go_day++;
// }
//
// }
// System.out.println("挖矿最后一天时间:"+(go_day-1));
// /**go_day_predict-2的原因:内部最后一次判断后,while循环仍旧进行中,所以go_day_predict会多+1,加上内部判断的多+1,总过多+2**/
// System.out.println("回到村庄天数:"+(go_day_predict-2));
// System.out.println("起点应该携带水和食物分配:"+(resources_mine_before[0]+mine_village_first_resources_before[0])+" "+(resources_mine_before[1]+mine_village_first_resources_before[1]));
// System.out.println("起点应该携带水和食物分配(箱数):"+(resources_mine_before[0]+mine_village_first_resources_before[0])/water[0]+" "+(resources_mine_before[1]+mine_village_first_resources_before[1])/food[0]);
//
// /**此刻如果回村庄补给后再去挖矿**/
// go_day = go_day_predict-1; /**回村的下一天**/
// int[] resources_mine__two = {0,0};
//
// /**在村庄的最后一天物资更新**/
// water_tony[go_day-1]=95; /**方案2:142**/ /**方案1:95**/
// food_tony[go_day-1]=95; /**方案2:140**/ /**方案1:95**/
// money_tony[go_day-1]=money_tony[go_day-1]-142*water[1]*2-140*food[1]*2;
//
// /**%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%**/
//
// /**!铭记:!**/
// /**运行下面方案时,请注释其中一个方案,以防止命名重复**/
//
// /**%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%**/
//
//
// /**方案1:**/
// /**Matlab计算村庄1回终点的最短路为3**/
// /**Matlab计算矿洞1回村庄的最短路为1**/
// /**Matlab计算矿洞回终点的最短路为4**/
// /**故我们可以挖矿的时间为截止到26天**/
//
// /**第二次去矿洞**/
// int village_mine_second_day=go_day+1;
// for (;go_day<village_mine_second_day;go_day++){
// if (weather[go_day]==1){
// resources_mine__two[0]+=sun[0]*2*water[0];
// resources_mine__two[1]+=sun[1]*2*food[0];
// water_tony[go_day]=water_tony[go_day-1]-sun[0]*2;
// food_tony[go_day]=food_tony[go_day-1]-sun[1]*2;
// } else if (weather[go_day]==2){
// resources_mine__two[0]+=hot[0]*2*water[0];
// resources_mine__two[1]+=hot[1]*2*food[0];
// water_tony[go_day]=water_tony[go_day-1]-hot[0]*2;
// food_tony[go_day]=food_tony[go_day-1]-hot[1]*2;
// } else if (weather[go_day]==3){
// resources_mine__two[0]+=sand[0]*water[0];
// resources_mine__two[1]+=sand[1]*food[0];
// water_tony[go_day]=water_tony[go_day-1]-sand[0];
// food_tony[go_day]=food_tony[go_day-1]-sand[1];
// village_mine_second_day++;
// }
// money_tony[go_day]=money_tony[go_day-1];
// }
//
// /**开始第二次挖矿**/
// for (;go_day<=day-4;go_day++){
// if (weather[go_day]==1){
// resources_mine__two[0]+=sun[0]*3*water[0];
// resources_mine__two[1]+=sun[1]*3*food[0];
// water_tony[go_day]=water_tony[go_day-1]-sun[0]*3;
// food_tony[go_day]=food_tony[go_day-1]-sun[1]*3;
// } else if (weather[go_day]==2){
// resources_mine__two[0]+=hot[0]*3*water[0];
// resources_mine__two[1]+=hot[1]*3*food[0];
// water_tony[go_day]=water_tony[go_day-1]-hot[0]*3;
// food_tony[go_day]=food_tony[go_day-1]-hot[1]*3;
// } else if (weather[go_day]==3){
// resources_mine__two[0]+=sand[0]*3*water[0];
// resources_mine__two[1]+=sand[1]*3*food[0];
// water_tony[go_day]=water_tony[go_day-1]-sand[0]*3;
// food_tony[go_day]=food_tony[go_day-1]-sand[1]*3;
// }
// money_tony[go_day]=money_tony[go_day-1]+earn;
// }
//
// /**矿洞回村庄**/
// int mine_village_second_day=go_day+1;
// for (;go_day<mine_village_second_day;go_day++){
// if (weather[go_day]==1){
// resources_mine__two[0]+=sun[0]*2*water[0];
// resources_mine__two[1]+=sun[1]*2*food[0];
// water_tony[go_day]=water_tony[go_day-1]-sun[0]*2;
// food_tony[go_day]=food_tony[go_day-1]-sun[1]*2;
// } else if (weather[go_day]==2){
// resources_mine__two[0]+=hot[0]*2*water[0];
// resources_mine__two[1]+=hot[1]*2*food[0];
// water_tony[go_day]=water_tony[go_day-1]-hot[0]*2;
// food_tony[go_day]=food_tony[go_day-1]-hot[1]*2;
// } else if (weather[go_day]==3){
// resources_mine__two[0]+=sand[0]*water[0];
// resources_mine__two[1]+=sand[1]*food[0];
// water_tony[go_day]=water_tony[go_day-1]-sand[0];
// food_tony[go_day]=food_tony[go_day-1]-sand[1];
// mine_village_second_day++;
// }
// money_tony[go_day]=money_tony[go_day-1];
// }
//
// System.out.println("第二次挖矿水和食物的分配:"+resources_mine__two[0]+" "+resources_mine__two[1]);
// System.out.println("第二次挖矿水和食物分配(箱数):"+resources_mine__two[0]/water[0]+" "+resources_mine__two[1]/food[0]);
//
// water_tony[go_day-1]= 42;
// food_tony[go_day-1]= 38;
//
// money_tony[go_day-1]=money_tony[go_day-1]-42*water[1]*2-38*food[1]*2;
//
// /**村庄回终点**/
// int[] village_end_resources = {0,0};
// for (;go_day<=day;go_day++){
// if (weather[go_day]==1){
// village_end_resources[0]+=sun[0]*2*water[0];
// village_end_resources[1]+=sun[1]*2*food[0];
// water_tony[go_day]=water_tony[go_day-1]-sun[0]*2;
// food_tony[go_day]=food_tony[go_day-1]-sun[1]*2;
// } else if (weather[go_day]==2){
// village_end_resources[0]+=hot[0]*2*water[0];
// village_end_resources[1]+=hot[1]*2*food[0];
// water_tony[go_day]=water_tony[go_day-1]-hot[0]*2;
// food_tony[go_day]=food_tony[go_day-1]-hot[1]*2;
// } else if (weather[go_day]==3){
// village_end_resources[0]+=sand[0]*water[0];
// village_end_resources[1]+=sand[1]*food[0];
// water_tony[go_day]=water_tony[go_day-1]-sand[0];
// food_tony[go_day]=food_tony[go_day-1]-sand[1];
// }
// money_tony[go_day]=money_tony[go_day-1];
// }
// System.out.println("村庄回终点需要的水和食物的分配:"+village_end_resources[0]+" "+village_end_resources[1]);
// System.out.println("村庄回终点需要的水和食物分配(箱数):"+village_end_resources[0]/water[0]+" "+village_end_resources[1]/food[0]);
// System.out.print("每天剩余水的量:");
// for (int i=0;i<=30;i++) {
// System.out.print(water_tony[i]+" ");
// }
// System.out.println("");
// System.out.print("每天剩余食物的量:");
// for (int i=0;i<=30;i++) {
// System.out.print(food_tony[i]+" ");
// }
// System.out.println("");
// System.out.print("每天剩余钱的量:");
// for (int i=0;i<=30;i++){
// System.out.print(money_tony[i]+" ");
// }
//
// /**方案2:**/
// /**Matlab计算村庄2回终点的最短路为2**/
// /**Matlab计算矿洞2回村庄的最短路为1**/
// /**Matlab计算矿洞回终点的最短路为2**/
// /**故我们可以挖矿的时间为截止到28天**/
// /**前提要求,物资足够持续挖矿并且能回到终点**/
//
//// /**第二次去矿洞**/
//// int village_mine_second_day=go_day+2;
//// for (;go_day<village_mine_second_day;go_day++){
//// if (weather[go_day]==1){
//// resources_mine__two[0]+=sun[0]*2*water[0];
//// resources_mine__two[1]+=sun[1]*2*food[0];
//// water_tony[go_day]=water_tony[go_day-1]-sun[0]*2;
//// food_tony[go_day]=food_tony[go_day-1]-sun[1]*2;
//// } else if (weather[go_day]==2){
//// resources_mine__two[0]+=hot[0]*2*water[0];
//// resources_mine__two[1]+=hot[1]*2*food[0];
//// water_tony[go_day]=water_tony[go_day-1]-hot[0]*2;
//// food_tony[go_day]=food_tony[go_day-1]-hot[1]*2;
//// } else if (weather[go_day]==3){
//// resources_mine__two[0]+=sand[0]*water[0];
//// resources_mine__two[1]+=sand[1]*food[0];
//// water_tony[go_day]=water_tony[go_day-1]-sand[0];
//// food_tony[go_day]=food_tony[go_day-1]-sand[1];
//// village_mine_second_day++;
//// }
//// money_tony[go_day]=money_tony[go_day-1];
//// }
////
//// /**开始第二次挖矿**/
//// for (;go_day<=day-2;go_day++){
//// if (weather[go_day]==1){
//// resources_mine__two[0]+=sun[0]*3*water[0];
//// resources_mine__two[1]+=sun[1]*3*food[0];
//// water_tony[go_day]=water_tony[go_day-1]-sun[0]*3;
//// food_tony[go_day]=food_tony[go_day-1]-sun[1]*3;
//// } else if (weather[go_day]==2){
//// resources_mine__two[0]+=hot[0]*3*water[0];
//// resources_mine__two[1]+=hot[1]*3*food[0];
//// water_tony[go_day]=water_tony[go_day-1]-hot[0]*3;
//// food_tony[go_day]=food_tony[go_day-1]-hot[1]*3;
//// } else if (weather[go_day]==3){
//// resources_mine__two[0]+=sand[0]*3*water[0];
//// resources_mine__two[1]+=sand[1]*3*food[0];
//// water_tony[go_day]=water_tony[go_day-1]-sand[0]*3;
//// food_tony[go_day]=food_tony[go_day-1]-sand[1]*3;
//// }
//// money_tony[go_day]=money_tony[go_day-1]+earn;
//// }
////
//// /**矿洞直接回终点**/
//// for (;go_day<=day;go_day++){
//// if (weather[go_day]==1){
//// resources_mine__two[0]+=sun[0]*2*water[0];
//// resources_mine__two[1]+=sun[1]*2*food[0];
//// water_tony[go_day]=water_tony[go_day-1]-sun[0]*2;
//// food_tony[go_day]=food_tony[go_day-1]-sun[1]*2;
//// } else if (weather[go_day]==2){
//// resources_mine__two[0]+=hot[0]*2*water[0];
//// resources_mine__two[1]+=hot[1]*2*food[0];
//// water_tony[go_day]=water_tony[go_day-1]-hot[0]*2;
//// food_tony[go_day]=food_tony[go_day-1]-hot[1]*2;
//// } else if (weather[go_day]==3){
//// resources_mine__two[0]+=sand[0]*water[0];
//// resources_mine__two[1]+=sand[1]*food[0];
//// water_tony[go_day]=water_tony[go_day-1]-sand[0];
//// food_tony[go_day]=food_tony[go_day-1]-sand[1];
//// }
//// money_tony[go_day]=money_tony[go_day-1];
//// }
////
//// System.out.println("第二次挖矿水和食物的分配:"+resources_mine__two[0]+" "+resources_mine__two[1]);
//// System.out.println("第二次挖矿水和食物分配(箱数):"+resources_mine__two[0]/water[0]+" "+resources_mine__two[1]/food[0]);
//// System.out.print("每天剩余水的量:");
//// for (int i=0;i<=30;i++) {
//// System.out.print(water_tony[i]+" ");
//// }
//// System.out.println("");
//// System.out.print("每天剩余食物的量:");
//// for (int i=0;i<=30;i++) {
//// System.out.print(food_tony[i]+" ");
//// }
//// System.out.println("");
//// System.out.print("每天剩余钱的量:");
//// for (int i=0;i<=30;i++){
//// System.out.print(money_tony[i]+" ");
//// }
//
// }
//}
/**2020年全国大学生数学建模竞赛B题第三题**/
//public class Math_model {
// public static void main(String[] args) {
// /**天气分布判断**/
// int[] weather1={2,2,1,3,1,2,3,1,2,2,3,2,1,2,2,2,3,3,2,2,1,1,2,1,3,2,1,1,2,2};
// int sun_num=0;
// int hot_num=0;
// int sand_num=0;
// for (int i=0;i<30;i++){
// if (weather1[i]==1)
// sun_num+=1;
// if (weather1[i]==2)
// hot_num+=1;
// if (weather1[i]==3)
// sand_num+=1;
// }
//
// int heavy = 1200;
// int day = 10;
// int money = 10000;
// int earn = 200;
// int[] water = {3,5};
// int[] food = {2,10};
// int[] sun = {3,4};
// int[] hot = {9,9};
// int[] sand = {10,10};
// int money_record_one[] = new int[100];
// int resources_record_one[][] = new int[2][100];
//
// int money_record_two[] = new int[100];
// int resources_record_two[][] = new int[2][100];
//
// int money_record_three[] = new int[100];
// int resources_record_three[][] = new int[2][100];
//
// int day_begin_end = 3;
//
// int day_begin_mine = 3;
// int day_mine_end = 2;
// int day_begin_mine_end = day_begin_mine+day_mine_end;
//
// int[] resources_one = {0,0};
// int go_day_one = 1;
// int[] resources_two = {0,0};
// int go_day_two = 1;
// int[] resources_three = {0,0};
// int go_day_three = 1;
//
// int num_simulate_one = 101;
// int num_sim_do_one = 1;
// int num_simulate_two = 101;
// int num_sim_do_two = 1;
// int num_simulate_three = 101;
// int num_sim_do_three = 1;
//
// /**选择线路1:直接去终点**/
// for (;num_sim_do_one<num_simulate_one;num_sim_do_one++){
// go_day_one=1;
// resources_one[0]=0;
// resources_one[1]=0;
// /**参考第一关第二关天气数据,对下一天的天气预测实行加权随机**/
// for (;go_day_one<=day_begin_end;go_day_one++) {
// int random_weather = (int) (Math.random() * (sun_num+hot_num) + 1);
// if (random_weather >= 1 && random_weather <= sun_num) {
// resources_one[0] += sun[0]*2;
// resources_one[1] += sun[1]*2;
// } else if (random_weather >= sun_num+1 && random_weather <= sun_num+hot_num) {
// resources_one[0] += hot[0]*2;
// resources_one[1] += hot[1]*2;
// }
// }
// money_record_one[num_sim_do_one-1] = money-resources_one[0]*water[1]-resources_one[1]*food[1];
// resources_record_one[0][num_sim_do_one-1] = resources_one[0];
// resources_record_one[1][num_sim_do_one-1] = resources_one[1];
// money=10000;
// }
//
// /**线路1情况下,高温是否等待**/
//
// int money_record_one_improve[][] = new int[day-day_begin_end+1][100];
// int resources_record_one_improve[][][] = new int[day-day_begin_end+1][2][100];
//
// int num_simulate_one_improve = 101;
// int[] resources_one_improve = {0,0};
// int go_day_one_improve = 1;
//
// int wait_hot_day=0;
// int wait_hot_cycle=day-day_begin_end;
// for (;wait_hot_day<=wait_hot_cycle;wait_hot_day++) {
// int num_sim_do_one_improve = 1;
// for (; num_sim_do_one_improve < num_simulate_one_improve; num_sim_do_one_improve++) {
// go_day_one_improve = 1;
// resources_one_improve[0] = 0;
// resources_one_improve[1] = 0;
// int day_begin_end_improve = 3;
// int wait_hot = 0;
// /**参考第一关第二关天气数据,对下一天的天气预测实行加权随机**/
// for (; go_day_one_improve <= day_begin_end_improve; go_day_one_improve++) {
// int random_weather = (int) (Math.random() * (sun_num + hot_num) + 1);
// if (random_weather >= 1 && random_weather <= sun_num) {
// resources_one_improve[0] += sun[0] * 2;
// resources_one_improve[1] += sun[1] * 2;
// } else if (random_weather >= sun_num + 1 && random_weather <= sun_num + hot_num) {
// if (wait_hot<wait_hot_day) {
// resources_one_improve[0] += hot[0];
// resources_one_improve[1] += hot[1];
// day_begin_end_improve++;
// wait_hot++;
// } else {
// resources_one_improve[0] += hot[0] * 2;
// resources_one_improve[1] += hot[1] * 2;
// }
// }
// }
// money_record_one_improve[wait_hot_day][num_sim_do_one_improve - 1] = money - resources_one_improve[0] * water[1] - resources_one_improve[1] * food[1];
// resources_record_one_improve[wait_hot_day][0][num_sim_do_one_improve - 1] = resources_one_improve[0];
// resources_record_one_improve[wait_hot_day][1][num_sim_do_one_improve - 1] = resources_one_improve[1];
// money = 10000;
// }
// }
//
// /**选择线路2:去挖矿再去终点**/
//
// for (;num_sim_do_two<num_simulate_two;num_sim_do_two++) {
// go_day_two=1;
// resources_two[0]=0;
// resources_two[1]=0;
// /**参考第一关第二关天气数据,对下一天的天气预测实行加权随机**/
// for (;go_day_two<=day_begin_mine;go_day_two++) {
// int random_weather = (int) (Math.random() * (sun_num+hot_num) + 1);
// if (random_weather >= 1 && random_weather <= sun_num) {
// resources_two[0] += sun[0]*2;
// resources_two[1] += sun[1]*2;
// } else if (random_weather >= sun_num+1 && random_weather <= sun_num+hot_num) {
// resources_two[0] += hot[0]*2;
// resources_two[1] += hot[1]*2;
// }
// }
// int day_mineToEnd=go_day_two;
// /**晴朗挖矿,高温走**/
// for (;go_day_two<=day_mineToEnd;go_day_two++) {
// int random_weather = (int) (Math.random() * (sun_num+hot_num) + 1);
// if (day_mineToEnd==day-day_mine_end){
// break;
// }
// if (random_weather >= 1 && random_weather <= sun_num) {
// resources_two[0] += sun[0]*3;
// resources_two[1] += sun[1]*3;
// money+=earn;
// day_mineToEnd++;
// } else if (random_weather >= sun_num+1 && random_weather <= sun_num+hot_num) {
// break;
// }
// }
// int go_day_two_end = go_day_two+day_mine_end;
// for (;go_day_two<go_day_two_end;go_day_two++) {
// int random_weather = (int) (Math.random() * (sun_num+hot_num) + 1);
// if (random_weather >= 1 && random_weather <= sun_num) {
// resources_two[0] += sun[0]*2;
// resources_two[1] += sun[1]*2;
// } else if (random_weather >= sun_num+1 && random_weather <= sun_num+hot_num) {
// resources_two[0] += hot[0]*2;
// resources_two[1] += hot[1]*2;
// }
// }
// money_record_two[num_sim_do_two-1] = money-resources_two[0]*water[1]-resources_two[1]*food[1];
// resources_record_two[0][num_sim_do_two-1] = resources_two[0];
// resources_record_two[1][num_sim_do_two-1] = resources_two[1];
// money=10000;
// }
//
//
// for (;num_sim_do_three<num_simulate_three;num_sim_do_three++) {
// go_day_three = 1;
// resources_three[0] = 0;
// resources_three[1] = 0;
//
// /**参考第一关第二关天气数据,对下一天的天气预测实行加权随机**/
// for (;go_day_three<=day_begin_mine;go_day_three++) {
// int random_weather = (int) (Math.random() * (sun_num+hot_num) + 1);
// if (random_weather >= 1 && random_weather <= sun_num) {
// resources_three[0] += sun[0]*2;
// resources_three[1] += sun[1]*2;
// } else if (random_weather >= sun_num+1 && random_weather <= sun_num+hot_num) {
// resources_three[0] += hot[0]*2;
// resources_three[1] += hot[1]*2;
// }
// }
// int day_mineToEnd=go_day_three;
// /**晴朗挖矿,高温停**/
// for (;go_day_three<=day_mineToEnd;go_day_three++) {
// int random_weather = (int) (Math.random() * (sun_num+hot_num) + 1);
// if (day_mineToEnd==day-day_mine_end){
// break;
// }
// if (random_weather >= 1 && random_weather <= sun_num) {
// resources_three[0] += sun[0]*3;
// resources_three[1] += sun[1]*3;
// money+=earn;
// day_mineToEnd++;
// } else if (random_weather >= sun_num+1 && random_weather <= sun_num+hot_num) {
// resources_three[0] += hot[0];
// resources_three[1] += hot[1];
// day_mineToEnd++;
// }
// }
// int go_day_three_end = go_day_three+day_mine_end;
// for (;go_day_three<go_day_three_end;go_day_three++) {
// int random_weather = (int) (Math.random() * (sun_num+hot_num) + 1);
// if (random_weather >= 1 && random_weather <= sun_num) {
// resources_three[0] += sun[0]*2;
// resources_three[1] += sun[1]*2;
// } else if (random_weather >= sun_num+1 && random_weather <= sun_num+hot_num) {
// resources_three[0] += hot[0]*2;
// resources_three[1] += hot[1]*2;
// }
// }
// money_record_three[num_sim_do_three-1] = money-resources_three[0]*water[1]-resources_three[1]*food[1];
// resources_record_three[0][num_sim_do_three-1] = resources_three[0];
// resources_record_three[1][num_sim_do_three-1] = resources_three[1];
// money=10000;
// }
//
// /**下面注释为三路线选择对比问题:方案一(直接回终点);方案二(矿山路且高温不等待);方案三(矿山路且高温等待)**/
//// System.out.println("");
//// System.out.println("方案一:");
////
//// for (int i=0;i<100;i++){
//// System.out.print(money_record_one[i]+" ");
//// }
////
//// System.out.println("");
//// System.out.println("方案二:");
////
//// for (int i=0;i<100;i++){
//// System.out.print(money_record_two[i]+" ");
//// }
////
//// System.out.println("");
//// System.out.println("方案三:");
////
//// for (int i=0;i<100;i++){
//// System.out.print(money_record_three[i]+" ");
//// }
//
// /**选择方案一后,模型优化,确认是否需要高温等待**/
// for (int j=0;j<=wait_hot_cycle;j++) {
// System.out.println("高温等待天数:"+j);
// for (int i = 0; i < 100; i++) {
// System.out.print(money_record_one_improve[j][i]+" ");
// }
// System.out.println("");
// }
//
// /**约束线购买原则**/
// int num_constraint = 0;
// int i=0;
// for (;i<100;i++){
// for (int j=0;j<100;j++){
// if (resources_record_one_improve[0][0][j] <= max(resources_record_one_improve[0][0])-i) {
// num_constraint++;
// }
// }
// if (num_constraint<=90){
// break;
// }
// num_constraint=0;
// }
// System.out.println("起点买水约束线:"+(max(resources_record_one_improve[0][0])-i));
// num_constraint = 0;
// i=0;
// for (;i<100;i++){
// for (int j=0;j<100;j++){
// if (resources_record_one_improve[0][1][j] <= max(resources_record_one_improve[0][1])-i) {
// num_constraint++;
// }
// }