不一定正确

This commit is contained in:
James 2020-03-20 17:40:39 +08:00
parent 74378a705d
commit ed4c1c1bb8
21 changed files with 283 additions and 0 deletions

27
1837_bestway/Readme.md Normal file
View File

@ -0,0 +1,27 @@
# 最佳路线
[问题描述]
* 塞内加尔是非洲的一个小国家,你也许很难在世界地图上找到它,甚至你有可能从未听说过它--它实在是个太小、太贫穷的国家了。可是就是这个人口不足900万、全国仅有2个标准足球场地的小国在2002韩日世界杯的非洲区预选赛中脱颖而出取得了世界杯决赛圈的入场券幸好去年中国队也进入了世界杯决赛圈不然可就丢脸了
* 在塞内加尔全国球迷欣喜若狂,世界足球行家大跌眼镜的同时,塞内加尔足协却发现自己面临着一个颇为尴尬的问题--说起来令人不可思议,由于打非洲区预选赛时四处征战,加上足协经营不力,现在足协的预算以几近赤字--也就是说,塞内加尔足协支付不起从本国乘飞机到达韩国参加世界杯的费用!经过三思,塞内加尔足协向非洲足联递交了一份《关于减免球队旅行费用》的申请;可是--众所周知的非洲足联也是惨淡经营幸好非洲足联秘书长神通广大弄来了M张优惠乘机券每张优惠券可以作用于一条航线使全队通过此航线的费用减半多张优惠券用于同一条线路其效果叠加--即在一条航线上用两张优惠券其费用降为原费用的1/4依此类推。
* 塞内加尔足球队要从塞内加尔国家机场出发,途经一些中转机场,最后要到达韩国釜山机场。为了合理地分配各张优惠券,使得所需费用最少,塞内加尔足协找到了你,请你编程解决这个问题。
[输入格式]
第1行有两个数N、M(0<N100,0M20)并用空格隔开分别表示包括起点塞内加尔国家机场终点韩国釜山机场的机场数以及塞内加尔足协现有的优惠券数量从第2行到第N+1行起每行有N个数其中第I行的第J个数代表从机场I到机场J所需费用为零的数代表两机场无航线假设起点标号为1终点标号为N
[输出格式]
第1行仅有一个数保留一位小数代表所求得的从机场1到机场N的最小费用输入数据保证从塞内加尔机场可达釜山机场。
[输入样例]
5 2
0 0 80 96 0
70 0 72 54 0
18 0 0 99 82
72 18 71 0 0
69 0 0 70 0
[输出样例]81.0
样例的一个具体方案1->3->5
[重要说明]
为了提高精度增加有效数值位数c/c++语言中实数类型必须定义为double类型而不是float类型
为了减少误差将原题测试数据的2位小数精度改为1位小数精度。

52
1837_bestway/bestway.cpp Normal file
View File

@ -0,0 +1,52 @@
#include <iostream>
#include<cstdio>
using namespace std;
double bi(double a,double b){
if(a==0) return b;
if(b==0) return a;
return a<b? a:b;
}
int main()
{
int n, m, a[101][101] = { 0 },ge[101]={0};//a[i][j] i-->j 的直飞路径,已用优惠券数
double f[101][21] = { 0 };//距离1最短距离已用优惠券数
cin >> n >> m;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
cin >> a[i][j];
}
}
for (int i = 1; i <= n; i++) {
f[i][0] = a[1][i];
f[i][1] = a[1][i] / 2;
ge[i]=1;
}
//重复n次保证全部轮过
for (int e = 1; e <= n; e++) {
//当前起点
for (int i = 1; i <= n; i++) {
//当前终点
if (f[i][0] > 0) {
for (int j = 1; j <= n; j++) {
if (a[i][j] > 0) {
if(ge[i]+1<=m) ge[i]++;
for (int k = 0; k <= ge[i]; k++) {
f[j][k]=bi(f[j][k],f[i][k]+a[i][j]);
if(k!=m){
f[j][k+1]=bi(f[j][k+1],f[i][k]+a[i][j]/2);
f[j][k+1]=bi(f[j][k],f[j][k+1]);
}
}
}
}
}
}
}
double ans=f[n][0];
for(int i=1;i<=m;i++){
if(ans>f[n][i]&&f[n][i]!=0){
ans=f[n][i];
}
}
printf("%0.1f",ans);
}

BIN
1837_bestway/bestway.exe Normal file

Binary file not shown.

16
1837_bestway/bestway2.cpp Normal file
View File

@ -0,0 +1,16 @@
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
int n, m, a[101][101] = { 0 },ge[101]={0};//a[i][j] i-->j 的直飞路径,已用优惠券数
double f[101][21] = { 0 };//距离1最短距离已用优惠券数
cin >> n >> m;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
cin >> a[i][j];
}
}
do{
}while (t<w);
}

View File

@ -0,0 +1,3 @@
# 标题
* 内容

Binary file not shown.

6
1837_bestway/main.cpp Normal file
View File

@ -0,0 +1,6 @@
#include <iostream>
int main()
{
std::cout << "Hello Easy C++ project!" << std::endl;
}

BIN
1837_bestway/main.exe Normal file

Binary file not shown.

View File

@ -0,0 +1,71 @@
70 20
0 9344604 0 0 0 925685 8341929 6280755 8989498 0 0 0 7712410 2633647 0 0 7741337 0 0 4095136 0 7346296 0 0 0 0 0 0 0 0 0 0 5523143 0 3221415 0 9941272 0 0 0 1011838 0 0 0 0 5423149 0 0 6650176 0 0 0 0 0 6838982 192532 0 2041958 9218223 0 504093 0 0 0 5923968 0 4064075 0 1713908 0
0 0 0 0 0 0 0 913680 0 0 0 0 3657670 0 0 0 0 0 3680721 0 0 0 0 7608524 9000221 0 0 5616954 0 0 0 8259027 5453587 0 7688289 5731702 9484667 0 0 0 0 8685243 4234567 0 4961516 0 1464613 0 0 0 0 9314729 0 0 0 0 0 0 0 2775611 0 0 0 0 0 3880171 0 3763802 0 8847589
0 0 0 4179598 0 6591777 6019537 7703848 0 0 0 0 5142141 1657327 7219553 0 0 0 0 0 0 0 0 0 2442179 0 0 6480333 0 0 0 0 0 0 0 0 0 5461591 0 0 0 0 0 5660546 0 3875846 0 0 0 0 0 0 431257 6388306 309530 0 4030235 9307941 0 0 0 563724 0 0 0 0 0 0 0 2250940
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1013577 0 0 495476 0 3701215 4884954 0 0 0 0 10002546 6061135 0 0 0 0 0 7543427 8151446 0 905508 4335318 0 1843821 0 0 0 0 0 2726719 0 395672 9432001 0 4002012 0 0 2687761 0 0 0 0 0 0 0 0 0 0 4863993 0 0 0 312733 0 0
0 0 0 0 0 0 1763755 9346750 0 0 0 0 0 9032516 0 0 5482369 0 0 0 0 4644819 0 7289025 8996995 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4163669 9310987 0 0 0 0 8827706 7483564 0 0 8100258 0 0 0 0 0 0 5638185 3068797 0 0 0 9688430 2276803 0 8468488 5411246 0 0 0 3230441
0 9098454 7865660 0 9137053 0 4210466 5979651 0 0 0 0 2698423 0 0 0 4182109 4929215 0 304897 9789477 7951071 0 342183 3237042 1799463 8207981 7698945 0 1168406 4759707 8713121 0 3812560 0 0 0 0 0 9576623 0 0 0 0 806989 6282584 0 0 5158944 0 0 0 8043531 0 583373 0 0 0 0 1869194 0 1881601 0 0 0 0 0 0 0 0
0 0 0 4205197 0 0 0 0 0 0 0 1956113 3098228 0 5184278 0 0 0 0 0 0 0 0 3975757 0 0 0 0 0 1416931 0 1007383 5446774 2960109 0 0 0 0 0 0 4260302 0 0 1583621 0 0 0 8573528 4759313 0 0 0 0 0 0 4080736 0 5152727 1837493 0 0 8423141 2222095 0 0 0 6058320 6582529 0 7471160
0 1829832 154610 0 1263054 0 0 0 0 8791891 9119643 0 2266594 0 0 0 1378179 4208232 0 9759083 0 0 0 0 0 0 4554281 0 0 2394147 8780437 9733525 0 2730992 0 0 542270 7263365 0 0 0 0 0 5144811 0 0 2376984 0 0 452462 8687932 341010 1553534 0 1453522 0 0 3609281 0 0 7346488 0 5923353 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 5596287 0 1863365 0 0 324863 4478152 0 0 0 0 9077648 0 1566257 1105988 0 0 2032823 5713865 0 4040213 4181092 3552688 0 0 9093567 461954 0 0 0 0 0 0 0 6362629 0 0 8547118 0 7940278 0 0 0 7926894 7181214 0 0 0 0 0 0 0 0 0 0 0 8847728 0 0
0 4414905 0 3787528 0 0 0 0 0 0 8599026 0 4250298 4617220 0 0 0 0 0 0 0 0 0 0 0 8169804 4150190 0 0 0 470279 0 1692223 0 0 439335 0 8030940 8600612 0 0 0 6288918 1515804 6022959 9324194 0 1192544 6457119 0 0 0 0 5832874 7698015 0 4954224 0 551944 0 0 0 0 5116053 0 8155977 0 0 0 0
0 0 0 7755007 0 0 0 3539336 745722 0 0 6781422 0 0 4280015 3699054 0 8358816 0 0 6183757 307288 0 0 7569940 0 9847772 0 0 6414008 0 0 0 6541095 0 0 0 0 0 0 0 0 0 4264981 6318272 0 4327433 5777993 2827931 1369947 0 1314630 0 3742284 0 0 0 4306256 0 9948216 0 0 0 5087626 0 0 4430922 0 0 0
9628949 0 4243116 5259683 0 7087187 5328150 0 0 0 1695517 0 0 0 0 8593912 0 7417217 0 0 7465964 9921251 0 0 0 0 8036708 0 0 546253 0 0 7619553 2234216 0 0 0 0 0 0 0 0 646857 0 0 1918781 0 0 745931 0 0 0 0 8096465 282411 0 8945253 0 4136355 5572555 7832822 0 2894419 8186451 0 4594227 632182 0 0 0
0 0 0 0 4525149 0 0 0 3291331 0 0 0 0 0 1247585 4788829 0 0 0 0 0 586388 1460870 5481557 0 0 9995303 0 0 0 0 0 0 0 0 0 1293607 0 0 0 0 0 0 0 0 6465243 0 4913280 0 2518141 0 0 2401945 7616776 1115516 0 2254577 5759106 4615858 0 0 0 0 0 8911719 0 9287548 0 0 1111413
7606363 0 8218588 5794352 0 0 0 0 0 0 0 5663045 0 0 0 0 8312172 2631528 0 0 0 0 102463 0 0 0 0 0 0 0 0 0 0 4118023 0 9785607 0 0 0 0 7111518 0 292722 0 9667042 698941 0 1813839 0 0 0 947863 0 5025219 0 9361567 0 2453687 4166432 0 8502618 6163032 8138284 0 0 0 0 9492858 8633232 4581252
0 0 0 0 0 0 0 2433662 0 4132299 0 0 0 0 0 0 0 0 0 0 0 0 2198224 3041810 0 0 1997981 0 0 0 3640829 7733394 0 0 8940011 4579975 0 0 3071129 0 2030102 0 0 517562 0 0 0 1105430 0 6946173 0 0 0 0 0 8335707 0 7990806 0 0 0 3084263 0 0 0 0 0 0 0 8255547
2070064 0 3336003 0 0 0 7591994 0 1662771 0 0 0 5952897 0 0 0 0 0 0 0 9225152 0 0 0 0 5959175 6479330 0 0 3349917 0 0 0 0 0 0 3003071 0 0 0 0 0 7771813 0 0 0 0 3506915 0 0 0 0 0 5509100 0 0 0 0 2701783 0 0 5406045 0 5615945 0 0 0 0 5519684 0
0 0 6774724 0 2922509 5327253 0 0 6042551 209382 0 0 0 3603116 5583132 0 0 3346444 0 0 8336794 0 3487413 9996371 0 0 0 0 0 0 0 0 4106764 0 4719287 0 0 0 9324916 0 0 8702138 0 0 0 0 8378745 6133153 6869220 0 2903903 0 0 5791576 1818566 1021961 6232267 0 2814783 1331960 0 5116417 0 2398778 0 0 0 0 0 2142917
0 0 0 0 0 0 3297976 0 0 0 3770009 0 0 9958225 6310494 0 0 0 0 0 0 0 8156233 0 0 0 0 0 3855142 4198605 2276925 1609003 0 0 7477426 0 0 2872115 0 7533456 0 0 0 0 8751383 0 0 2920841 0 0 2026273 0 0 8618270 0 0 4897040 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 6880196 0 0 0 0 0 0 0 8921770 0 0 3441112 9528192 0 0 0 0 0 0 0 0 0 0 0 4427153 0 7125483 0 7012981 0 0 0 5116715 0 0 7267248 0 7135582 7396388 0 0 2332332 3342819 0 0 0 0 0 0 0 0 0 7406654 0 0 0 4601071 0 1811230 7943243 0 0 0 0 8082564 4026319 0 8020260
6227450 0 9929595 0 0 0 9172244 0 0 0 6306501 7079717 0 5260929 0 0 0 5728788 5152904 0 1723448 0 1330551 3618115 0 0 5045221 0 7661259 0 0 2811783 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2156116 0 0 0 1146531 0 0 5553602 0 2532748 3461811 0 0 0 4181673 0 0 6242948 4917665 4483886 0
6489137 0 0 0 1410055 0 0 0 625126 0 0 0 0 0 0 0 0 0 0 0 0 3376159 5669409 0 0 0 1491139 0 0 2754336 0 0 1232283 0 0 0 398289 0 9435802 5978389 2355154 0 0 0 0 1822254 0 6290517 5119824 0 0 0 0 0 3163642 0 2480395 0 7296204 2986434 6901359 0 5278227 8785646 0 0 0 0 0 0
0 8603943 0 0 0 3467717 0 0 7237955 5432916 3718248 1283027 0 6469272 0 5548646 0 0 0 5732855 0 0 0 0 0 0 1435710 176163 0 0 4432123 8007854 1254861 1918889 732514 0 0 0 4093637 0 0 0 0 0 0 2052845 0 0 0 0 0 0 0 0 248694 0 0 4415444 0 3366881 1233353 9046041 5860590 0 0 0 0 0 1504724 0
9684266 0 6244525 0 9315667 7216935 0 4993126 0 0 0 0 2738596 0 4090596 2513746 0 0 293234 0 0 0 0 0 0 8584596 0 2350752 9542547 4858364 0 0 0 0 0 7613251 0 0 0 0 0 5735137 2153245 0 254678 0 9766312 2726673 0 0 0 0 973186 6207101 0 9119245 1248512 0 0 0 0 0 0 0 8339743 597714 0 0 9401530 0
0 0 0 1687382 6306939 0 0 4709739 1727298 0 7271202 0 0 0 9105254 0 742417 0 7679243 0 0 0 9875606 0 0 4568646 0 9822564 0 123351 4204057 0 0 0 8594548 0 0 238800 0 0 0 0 6319457 5013683 1233681 0 4489192 0 4608363 0 0 0 0 0 0 0 0 4519364 0 7355443 0 0 0 7552210 0 0 1857128 0 0 9332971
0 3435045 565189 0 0 0 1282867 0 0 5783309 0 0 0 0 5536782 4723271 0 0 672824 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9834649 0 0 0 0 0 4845404 0 0 0 0 0 7995702 0 0 0 0 7040614 0 0 0 0 5683151 0 0 5049105 0 0 6280484 7396878 0 3377982 3221619 7345768 0 0
0 2737002 0 0 0 9638567 0 5129898 0 7748310 0 6608260 0 0 0 4226474 0 0 0 0 0 6072704 0 0 3043521 0 0 0 0 0 6111930 0 1327967 2084252 467334 0 0 0 942703 0 0 1046749 0 219717 520506 4866838 1898526 7475927 0 0 0 0 7464006 0 0 0 0 0 3616918 3823360 681761 0 0 9251786 0 0 0 0 0 0
7306168 0 0 0 0 0 777415 0 0 0 3974589 0 0 3380132 0 0 9472591 860194 0 0 4010472 0 0 0 379442 0 0 0 0 8881878 8815732 0 0 0 0 0 0 0 8214824 0 0 0 0 9059831 2706814 0 0 0 0 0 1404694 8436823 6573545 1377716 0 5952961 0 0 0 0 0 832957 0 0 0 1426502 0 0 0 0
0 0 3146635 656196 0 0 0 0 0 562998 0 0 0 0 468435 0 4351726 0 0 0 0 0 2068821 0 0 0 9857892 0 0 0 7986817 3938598 0 0 0 0 5299559 0 0 0 4856109 4288556 8463505 0 0 0 7145689 0 0 0 7639465 0 0 0 0 0 0 0 6783764 0 7400290 816036 0 0 942443 8374875 0 0 0 2168758
9696855 0 0 0 1959481 9558199 0 311824 0 0 0 1071084 0 0 0 0 52569 0 0 0 0 0 0 0 9079425 0 0 692025 0 0 0 0 0 0 2598605 0 0 1443667 6390008 0 0 0 0 8189143 0 1232844 0 0 7423170 9047150 0 0 0 0 0 0 7010549 0 0 3882529 0 0 4986015 0 9467724 0 9287408 0 3899753 0
7940573 0 3286308 6417596 9601613 0 0 5601801 0 7808897 0 0 0 6368571 0 1089261 0 0 0 0 0 0 0 0 0 4812548 0 3724247 0 0 5156966 0 0 0 4798768 4499043 5541517 0 0 4540809 0 0 1255486 0 0 2525248 1292377 1641008 0 0 0 0 0 0 0 0 1389773 239959 0 6268199 0 0 7964417 9094225 0 0 0 2975969 0 0
0 4859049 0 0 0 1064886 9171942 62045 6928171 0 6314200 0 0 0 5932658 0 0 6319265 0 0 0 0 0 8324762 0 0 5565424 9235577 0 0 0 0 0 0 0 0 0 0 0 0 6754785 1134247 7566763 6723388 0 0 0 0 0 0 0 0 1992616 7395423 1483350 0 3927904 0 0 0 0 0 0 0 0 0 0 0 0 7405873
3175439 0 0 3899876 0 3258614 0 0 4908478 0 0 4585161 0 764272 0 4334997 0 0 7108257 0 2765919 0 0 0 0 0 7020859 7720356 0 273688 0 0 7793128 7526607 0 0 0 0 0 0 9670830 0 0 2868170 0 0 0 1175987 0 3737863 0 0 0 0 0 0 0 5915967 2415106 9353106 0 92271 3538844 0 0 8312686 0 3476241 6451312 0
0 1957102 0 0 0 0 5735746 0 0 0 6305970 3276674 0 18245 0 0 3811887 0 0 0 8635389 0 8950792 1834054 0 0 0 19065 0 0 0 1253488 0 0 5390963 8490028 0 0 4743378 0 0 8105298 0 4820550 5074238 0 0 0 0 0 2554936 0 0 0 2805745 0 8652246 1108664 0 0 1756782 0 1447611 0 0 0 7078833 0 0 0
0 0 0 0 0 0 3378355 0 9869467 0 0 0 0 0 3160199 5257004 0 0 0 0 5338050 1911597 0 0 0 7535699 334656 0 0 0 0 2861731 0 0 0 721580 4815500 0 0 1458180 0 0 0 2522689 0 0 0 3225083 0 0 0 0 0 6399084 9786019 6097984 0 0 0 0 0 0 5924654 0 0 0 3508848 0 0 2626542
0 0 1501272 0 0 0 0 0 0 0 0 3670717 0 0 8985551 5948266 0 0 0 2845876 0 0 6667609 0 0 0 0 7077629 0 0 3042032 0 0 0 0 0 0 5497947 8255506 0 0 0 0 0 4657611 0 2413783 0 0 0 0 0 3325219 0 0 0 0 5262011 7177170 0 9150112 8957377 2528464 0 8061053 0 0 0 0 0
0 0 0 0 261777 0 0 4916068 7670877 0 0 8352834 0 0 0 5223680 0 0 0 2463210 0 0 0 2798060 863730 2202259 1712945 0 4686187 6830241 0 0 0 8147824 0 0 0 9613280 7905558 0 0 0 0 7347937 4200076 2282071 0 1508016 7818168 0 0 0 0 0 9627712 0 0 0 2346902 4513124 0 0 0 2494731 0 7345951 0 0 3312561 0
1728902 9318524 547064 0 0 0 0 0 0 1785141 2796555 0 5110649 0 0 0 0 0 0 0 0 0 0 0 0 0 5199366 8999673 0 0 0 0 0 0 0 0 0 8429390 8957118 4933334 9790435 7740851 0 0 0 3330994 8652328 0 1013126 7583088 4670129 0 4274074 0 0 6287059 0 6451046 0 4342457 0 0 0 1980330 9689117 5738716 0 0 6666865 0
4696039 4979830 0 0 4855088 6541527 0 0 2316604 0 1963069 0 1327308 3407808 0 0 0 0 4678950 8863346 0 4313543 0 0 3018964 6972428 0 0 7062852 0 9833428 0 0 1660621 0 2461970 0 0 5251568 3240411 0 5160514 0 0 6053708 0 9905093 3568246 0 0 0 0 1024863 3032995 862533 0 5145249 0 1923745 0 9147534 5664048 0 1668412 6123821 0 0 0 7729976 0
7133191 3723328 0 3100157 0 9476976 0 0 1408200 0 15454 0 9149062 0 660790 0 0 0 4404233 3937176 9253325 0 5168886 0 8136815 0 9680481 2036778 0 9295443 4271890 0 0 6609000 5684900 0 6045543 0 0 0 7896388 0 0 0 8592874 6224126 0 9008259 6450317 9245953 6763014 0 0 4514826 3222932 0 0 5830594 0 4108568 0 0 0 0 6170093 0 0 0 1337645 0
1679267 3898161 0 0 2272406 0 0 6186383 1022924 2467156 0 6493123 0 0 682036 7386479 0 0 0 0 0 0 8629679 545820 0 0 4417476 0 0 9354399 0 0 0 1615857 0 7708010 0 0 0 0 0 0 4826504 9087976 0 4039830 0 0 0 0 3710913 7273293 0 7619013 0 5365510 0 0 0 0 0 9221273 5729812 9195178 0 3848069 7354581 0 0 8775830
0 0 0 0 630914 570401 0 2498297 0 7944635 0 8272260 1872181 0 0 6422503 0 0 0 0 0 0 0 0 0 0 0 0 0 4468993 0 0 6865376 0 0 5964681 0 0 0 0 0 0 0 5308556 3373099 0 0 894371 0 0 0 0 9910481 9637276 1060634 0 5792632 0 0 0 0 9610353 0 0 0 7807264 8155139 4582033 0 0
0 0 0 702053 0 0 0 0 0 0 5454629 5910118 0 6557927 4309536 2610722 0 7566897 0 0 784082 0 0 0 0 0 8510996 3301462 0 5530147 0 0 0 0 0 0 4731490 0 5144181 8266179 0 0 9532989 0 2877049 0 0 0 0 0 6037877 0 0 4739510 4498163 0 0 0 0 0 0 6986930 0 0 0 0 0 0 0 0
0 0 0 8723107 0 0 0 0 0 0 0 0 4121263 0 0 0 0 1219035 3753133 3231071 8160363 0 0 0 0 841566 0 0 3270732 5981528 0 5565478 0 2591486 0 6182158 0 237225 0 0 0 0 0 5762463 0 6371504 0 0 0 0 0 0 0 5315897 0 0 6550852 3801623 3768681 3754261 0 0 0 0 535587 0 359245 0 0 3670328
0 5270812 0 0 0 0 0 0 0 0 0 0 4656246 0 0 3966602 5572659 0 0 0 0 0 5710309 8762343 0 0 3507125 0 0 0 0 1880689 0 0 0 0 1634059 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4412270 0 7979250 0 0 0 9020641 0 0 5565950 0 1272039 0 0 0 0 6933365
1033238 1966674 0 0 0 0 33975 2786457 3157095 5360196 6330102 0 0 0 0 0 0 0 0 0 0 0 9023682 3229767 1104773 0 0 0 0 0 0 6880606 0 0 0 4161645 511511 0 0 0 0 0 0 6879753 0 9087297 0 8153391 0 4283021 0 0 0 7994362 8319453 0 8892979 0 0 6910172 0 1682927 0 0 8214497 9898990 0 0 0 0
0 0 6041584 1559609 0 0 0 0 6749017 2242741 0 5028958 0 0 0 7392029 0 3500109 2890956 0 2703875 5030436 6580942 7809476 0 150593 5130950 8042049 0 0 5311534 44803 3573874 0 0 0 2382780 482306 0 0 8315541 0 0 0 0 0 0 0 0 0 2703164 0 0 0 0 0 0 0 71723 0 6875522 8900818 0 0 1840249 0 0 0 0 0
0 5554209 0 0 3247155 0 0 0 0 0 0 0 0 0 0 0 0 6968110 7281513 6960033 0 0 7122524 0 0 0 1209585 0 0 5048073 7341491 3844947 0 0 0 0 8655415 0 8237671 5401469 894412 0 0 0 0 0 0 3714281 0 2548813 2268643 0 6589659 0 0 0 0 0 0 0 23136 7974856 1637416 0 0 0 0 0 0 0
639453 0 6480195 0 0 0 0 2698629 0 0 0 0 0 0 0 0 0 3672935 5565221 0 0 0 4730773 0 0 0 0 9894997 0 0 3925730 0 0 0 1199542 0 0 6978314 0 8395711 0 943776 0 0 0 0 0 0 2060819 8867202 0 0 0 9098255 0 0 0 481778 0 1517271 0 1072615 1836324 6823905 0 0 0 0 0 5930214
0 4303059 0 0 0 0 5317514 0 6525135 8551323 0 9629314 0 1841697 0 0 0 0 0 0 0 0 1271604 7816522 0 0 0 0 0 7493206 8402045 7309572 0 0 6193668 0 776165 0 0 0 1903713 4865568 0 0 0 0 0 0 0 2073592 4843666 0 0 7480981 0 2753119 0 7004938 0 491534 0 0 0 2318388 0 2417008 0 0 9589324 3149844
0 414659 0 0 0 0 0 1260633 0 2527080 0 0 9371403 1478225 8038817 0 0 6164447 0 6852373 0 0 7802471 2143150 3454262 5241181 0 0 0 0 0 1058834 0 2458487 4901975 0 0 5650293 0 0 0 0 0 2420750 0 5187900 8035775 0 0 0 8841168 0 0 0 2002694 7277009 8826345 0 0 0 2581775 4181923 0 0 762280 0 7010465 0 1399011 0
0 4775459 0 0 0 0 0 1640050 0 0 0 0 0 1213590 0 0 0 2316087 0 809873 0 0 0 0 0 0 0 5353835 5247796 2603002 0 0 0 0 0 7688398 0 6281229 0 0 0 0 0 2841777 0 0 6779330 0 6803661 0 0 8552034 6980966 0 0 0 0 4728261 0 0 0 593483 0 4218913 9157390 0 0 0 0 9311947
3850230 0 0 0 6966742 7334258 0 0 0 0 0 0 0 0 0 0 9031887 0 584582 0 9140552 0 2316790 4610272 0 4362928 4410750 2610547 0 0 0 0 0 0 0 0 0 5910136 4495862 0 3135640 9210415 0 0 5588215 0 9586149 0 1025496 0 6748287 0 0 0 0 0 122593 0 0 1071903 8705873 0 4634205 0 0 0 444158 0 0 0
6516562 0 0 0 5747964 0 0 0 218474 0 0 0 6867391 0 0 0 5691498 0 0 0 0 9518650 0 3545294 0 0 836076 0 5404336 0 0 0 1637961 493722 0 0 0 0 435156 0 0 0 746368 7610237 8920379 401922 9013720 5313539 0 1382293 0 0 0 4378155 0 2445137 3905755 0 0 3936816 0 0 0 9305696 0 2582980 0 0 0 0
4339030 2135798 0 7637042 0 0 9801896 0 4627999 0 2182572 0 0 798726 0 0 0 0 0 4583530 6030257 2924932 0 0 0 0 6206565 0 8326166 2314232 0 0 0 3942661 0 6468238 3020516 0 9904767 0 0 1896505 0 2109025 681016 9629276 0 8485279 0 0 0 0 3373487 0 0 0 0 6617960 0 0 0 4335599 0 0 0 949160 0 9537128 6508397 0
0 0 0 5206673 0 5952236 0 0 0 0 0 3884661 0 0 0 0 0 539054 0 0 0 0 0 0 7221110 183284 4568769 2094865 0 0 525831 0 1021605 0 6625100 6678978 0 0 0 6698986 0 0 0 0 0 4332564 0 0 0 0 0 0 0 0 0 0 9170458 2534995 0 9911169 0 4890688 0 6169350 0 0 0 0 1358425 0
0 0 261006 0 3009447 0 0 0 0 0 0 4476045 6037504 0 4471746 9474161 0 0 1746485 0 0 0 8097205 1970695 0 9392489 0 0 0 3152077 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8234638 0 0 0 0 2191290 0 0 5287744 0 0 0 6560090 0 0 434521 0 2751343 0 0 0 0 0 0 0
0 0 0 0 0 0 6157306 0 4425257 0 1668958 0 0 0 0 0 0 2116110 9995881 7506990 0 0 1167144 0 4552004 0 0 0 0 4006487 0 0 0 2976514 5580417 9805731 0 0 0 0 5896244 0 0 6871138 7968980 0 0 0 0 222081 4709632 9052487 2448226 4849006 0 0 0 0 1137358 820861 1334533 0 9925278 2700399 0 0 0 0 0 0
0 0 0 0 3990224 6471331 0 975444 0 4083115 2892326 0 2863703 0 0 0 0 0 0 0 0 0 0 0 0 366296 4608024 0 4127663 0 0 0 3730641 0 0 0 0 0 2623461 5295603 0 9004632 0 0 0 5150043 0 0 0 558388 4338218 0 0 4905713 0 0 0 0 0 0 0 0 6884479 0 0 0 0 6265506 9232828 0
0 0 0 9365784 0 0 0 0 0 6351923 0 0 1842500 0 9270944 0 0 0 0 3951315 0 0 0 0 0 8392435 0 0 0 8679127 0 1856710 0 0 3068690 0 0 8443779 0 7676272 0 0 0 0 0 0 0 0 1414247 0 2512662 5943979 7472867 0 2971508 0 4671817 5085041 0 9978316 7724905 0 6976610 0 0 0 0 0 0 0
0 8142162 8329795 9607973 0 7258835 0 2613862 7295107 7024073 0 0 0 8786247 1722728 0 2414765 0 9449922 0 0 0 7984951 0 0 7634463 1939291 0 9259710 2800516 0 0 0 0 2352890 0 0 0 0 0 0 0 0 7143408 4195143 0 0 6445392 0 0 0 282516 0 0 8533774 1527337 2358621 0 0 0 0 0 0 0 5945087 0 0 616926 0 0
9712156 7820008 3085585 0 0 0 2655871 2573991 2219378 0 0 6727372 0 9152228 0 0 0 0 3990383 0 0 0 0 0 0 0 0 0 4852063 0 0 0 0 0 0 3914270 0 0 6867399 0 0 2017576 0 0 796711 1451454 882259 0 0 0 8121827 0 0 0 9029491 355378 0 9013804 0 2267507 0 0 0 4960704 0 0 0 0 0 0
0 4676154 6549330 9566507 3557350 0 6407711 1274544 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8613911 0 1639328 8737507 0 0 0 0 1606438 0 0 0 1620041 0 7851562 7716216 0 5185493 0 2596397 0 0 2010135 0 0 0 1897320 7910956 0 7126447 0 0 0 0 1253806 1028513 0 0 5421988 0 0 0 0 0 0 0 0 1177652
4338817 0 0 0 0 6993550 0 0 0 0 667784 4262259 0 0 9034741 0 0 9571101 0 0 0 0 0 0 0 8864034 0 0 0 0 0 0 0 0 0 0 5362162 2369693 0 0 3912044 0 0 2566081 0 0 4411123 0 0 0 2107844 0 0 0 4693528 0 0 0 0 0 0 0 0 0 0 2708799 0 3177649 0 0
7010235 0 3559575 0 0 0 0 0 0 0 0 7761256 3193073 0 0 3410150 0 0 2153071 0 0 1177315 0 0 0 0 0 0 7873093 2835131 612230 0 145732 0 0 9378582 1545870 0 0 9024411 0 0 1039892 0 0 0 0 8146841 0 3898145 0 0 0 0 0 0 6211566 0 0 0 0 1391453 978650 0 2081197 0 0 0 9525650 0
0 0 0 0 0 0 9857915 6728375 0 0 2329793 5678239 0 0 0 0 6818582 0 0 2165074 1087056 0 0 0 8413376 0 8929028 0 0 0 0 7711335 5737406 8057993 0 0 0 0 4911077 0 0 9466593 8970730 6491289 0 6594261 0 0 5624273 0 0 0 1489398 5507714 0 5895707 0 0 0 0 0 0 5901271 7375630 0 0 0 0 8806105 3961715
0 3976820 0 6905510 0 8743511 173530 0 0 4949034 6562032 0 0 0 4171810 0 949413 1418558 0 0 3970668 0 0 5437412 0 0 0 0 0 0 0 0 0 0 1433455 0 3441391 0 1964061 0 79366 1966391 5835814 6907896 0 0 0 6802176 0 0 0 0 5856171 7952723 0 0 0 1374972 2854924 0 0 0 0 0 0 0 0 1437951 0 0
0 1452678 0 6908045 0 0 217538 0 6356822 9262023 0 0 0 0 5428802 0 0 0 4518612 0 0 0 1934618 138820 0 0 0 0 0 6321153 9284487 0 2944080 0 0 7271753 0 0 0 0 0 7290230 0 0 0 0 0 3406543 0 0 0 5260222 2371015 0 2280110 613291 0 0 8039608 0 0 8954408 2292521 0 0 0 0 0 6810643 0
0 0 0 5967995 6139258 0 0 4241995 0 0 0 4374569 0 7275051 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7866424 0 1112540 0 0 0 1662181 0 3541313 0 0 8039203 211228 8320119 5022009 0 16436 0 0 0 4070240 7804943 569170 305728 0 0 0 0 0 0 0 0 8698320 0 7427834 0 0 0
0 0 2965581 715320 0 9019234 0 7072273 8228037 4822349 0 0 0 1770505 7566011 0 8635976 0 383585 2443499 7241428 2949095 9995584 0 4701437 0 0 0 516877 0 8205042 0 0 1706270 0 0 0 9795930 2341818 0 0 0 9468867 2500551 6318117 207233 0 0 0 311297 0 0 0 0 0 5020600 0 0 0 5768252 0 8120146 838585 0 0 0 5435565 0 0 0
0 0 0 0 0 0 0 2139258 0 0 2426335 0 0 7549447 0 8928143 339351 0 0 2887743 814138 0 0 9925014 9235665 0 0 8010388 0 3170895 0 0 9463721 9854601 4254338 9228609 0 2685693 3222974 0 0 0 5676731 0 6903519 0 0 8629003 0 9761253 0 5184533 0 7887055 0 0 9834841 1341784 0 0 7825008 0 8525824 364427 0 4251665 1696127 8523207 0 0

View File

@ -0,0 +1,6 @@
5 0
0 1 5 8 9
9 0 2 6 9
5 6 0 2 7
4 7 3 0 1
3 1 8 4 0

6
1837_bestway/test/in.txt Normal file
View File

@ -0,0 +1,6 @@
5 2
0 0 80 96 0
70 0 72 54 0
18 0 0 99 82
72 18 71 0 0
69 0 0 70 0

18
1837_bestway/test/out.txt Normal file
View File

@ -0,0 +1,18 @@
## z:\Chao\src\1837_bestway\test\in.txt
2020/03/16 ÖÜÒ» 18:53:49.79
81.0
-----------------------------------------------
Process exited after 210 ms with return value 0
## z:\Chao\src\1837_bestway\test\In0 (3).txt
2020/03/16 ÖÜÒ» 18:53:49.79
555706.0
-----------------------------------------------
Process exited after 260 ms with return value 0
## z:\Chao\src\1837_bestway\test\In1 (3).txt
2020/03/16 ÖÜÒ» 18:53:49.79
6.0
-----------------------------------------------
Process exited after 90 ms with return value 0

View File

@ -0,0 +1,24 @@
# 马房分配
[问题描述]
一个农夫要把 n 只马分配到 k 个马房里,放置的规则是:如果第 1 到第 i 只马放入第一个马房那么第i+1到第j只放入第二个马房接下来第j+1至第p只马放入第三个马房......,以此类推。此外对于每一个马房都有一个叫做“不高兴系数”,即白色马的数量*黑色马的数量。
你的任务是合理地分配这 n 只马,使得它所有马房的“不高兴系数”和最小。
[输入格式]
第一行有 2 个整数n(1≤n≤500)和 k(1≤k≤)。接下来的 n 行有 n 个数。第 i 行为第 i
只马的颜色1 是黑色0 是白色。
[输出格式]
输出最小的“不高兴系数”的总和。
[输入样例]
6 3
1
1
0
1
0
1
[输出样例]
2

View File

@ -0,0 +1,3 @@
# 标题
* 内容

Binary file not shown.

View File

@ -0,0 +1,32 @@
#include <iostream>
using namespace std;
int main()
{
int n, k, a[501] = { 0 }, num[501] = { 0 }, sum = 0,f[501]={0},t=0,w=1,ans,now[501]={0};
cin >> n >> k;
for (int i = 1; i <= n; i++) {
cin >> a[i];
if (a[i] == 1) {
num[i] = ++sum;
}
}
now[1]=1;
do{
t++;
for(int i=now[t]+1;i<n;i++){
f[++w]=f[t]+(num[i]-num[now[t]-1])*num[i];
now[w]=i;
}
int bi=f[t]+(num[n]-num[now[t]-1])*num[n];
if(bi<sum){
sum=bi;
}
}while(t<w);
cout<<sum;
/*
for(int i=1;i<=n;i++){
for(int j=1;j<=k;j++){
}
}*/
}

Binary file not shown.

View File

@ -0,0 +1,6 @@
#include <iostream>
int main()
{
std::cout << "Hello Easy C++ project!" << std::endl;
}

BIN
1875_houseschoose/main.exe Normal file

Binary file not shown.

View File

@ -0,0 +1,7 @@
6 3
1
1
0
1
0
1

View File

@ -0,0 +1,6 @@
## z:\Chao\src\1875_houseschoose\test\in.txt
2020/03/18 ÖÜÈý 18:13:18.71
-----------------------------------------------
Process exited after 140 ms with return value -1073741819