https://codeforces.com/gym/101982/attachments

K 打表暴力

/*#include<bits/stdc++.h>
using namespace std; map<int,double> dmin,dmax; bool legal(int n){
int a[10]={};
int cur=10;
while(n){
int t=n%10;
if(t==0||a[t]||t>=cur)
return false;
cur=t;
a[t]++;
n/=10;
}
return true;
} int main(){
int cnt=0;
freopen("Yinku.out","w",stdout);
for(int i=1;i<=123456789;i++){
if(legal(i)){
//calc(i);
printf("%d,",i);
cnt++;
}
}
cerr<<cnt<<endl;
}*/ /*int num[]={1,2,3,4,5,6,7,8,9,12,13,14,15,16,17,18,19,23,24,25,26,27,28,29,34,35,36,37,38,39,45,46,47,48,49,56,57,58,59,67,68,69,78,79,89,
123,124,125,126,127,128,129,134,135,136,137,138,139,145,146,147,148,149,156,157,158,159,167,168,169,178,179,189,234,235,236,237,238,239,245,
246,247,248,249,256,257,258,259,267,268,269,278,279,289,345,346,347,348,349,356,357,358,359,367,368,369,378,379,389,456,457,458,459,467,468,
469,478,479,489,567,568,569,578,579,589,678,679,689,789,1234,1235,1236,1237,1238,1239,1245,1246,1247,1248,1249,1256,1257,1258,1259,1267,1268,
1269,1278,1279,1289,1345,1346,1347,1348,1349,1356,1357,1358,1359,1367,1368,1369,1378,1379,1389,1456,1457,1458,1459,1467,1468,1469,1478,1479,
1489,1567,1568,1569,1578,1579,1589,1678,1679,1689,1789,2345,2346,2347,2348,2349,2356,2357,2358,2359,2367,2368,2369,2378,2379,2389,2456,2457,
2458,2459,2467,2468,2469,2478,2479,2489,2567,2568,2569,2578,2579,2589,2678,2679,2689,2789,3456,3457,3458,3459,3467,3468,3469,3478,3479,3489,
3567,3568,3569,3578,3579,3589,3678,3679,3689,3789,4567,4568,4569,4578,4579,4589,4678,4679,4689,4789,5678,5679,5689,5789,6789,12345,12346,12347,
12348,12349,12356,12357,12358,12359,12367,12368,12369,12378,12379,12389,12456,12457,12458,12459,12467,12468,12469,12478,12479,12489,12567,12568,
12569,12578,12579,12589,12678,12679,12689,12789,13456,13457,13458,13459,13467,13468,13469,13478,13479,13489,13567,13568,13569,13578,13579,13589,
13678,13679,13689,13789,14567,14568,14569,14578,14579,14589,14678,14679,14689,14789,15678,15679,15689,15789,16789,23456,23457,23458,23459,23467,
23468,23469,23478,23479,23489,23567,23568,23569,23578,23579,23589,23678,23679,23689,23789,24567,24568,24569,24578,24579,24589,24678,24679,24689,
24789,25678,25679,25689,25789,26789,34567,34568,34569,34578,34579,34589,34678,34679,34689,34789,35678,35679,35689,35789,36789,45678,45679,45689,
45789,46789,56789,123456,123457,123458,123459,123467,123468,123469,123478,123479,123489,123567,123568,123569,123578,123579,123589,123678,123679,
123689,123789,124567,124568,124569,124578,124579,124589,124678,124679,124689,124789,125678,125679,125689,125789,126789,134567,134568,134569,
134578,134579,134589,134678,134679,134689,134789,135678,135679,135689,135789,136789,145678,145679,145689,145789,146789,156789,234567,234568,
234569,234578,234579,234589,234678,234679,234689,234789,235678,235679,235689,235789,236789,245678,245679,245689,245789,246789,256789,345678,
345679,345689,345789,346789,356789,456789,1234567,1234568,1234569,1234578,1234579,1234589,1234678,1234679,1234689,1234789,1235678,1235679,
1235689,1235789,1236789,1245678,1245679,1245689,1245789,1246789,1256789,1345678,1345679,1345689,1345789,1346789,1356789,1456789,2345678,2345679,
2345689,2345789,2346789,2356789,2456789,3456789,12345678,12345679,12345689,12345789,12346789,12356789,12456789,13456789,23456789,123456789}; double p[13]; map<int,double> dmin,dmax; int link(vector<int> s,int ex1,int ex2=-1,int ex3=-1,int ex4=-1){
int ans=0;
int n=s.size();
for(int i=0;i<n;i++){
if(i==ex1||i==ex2||i==ex3||i==ex4)
continue;
else{
ans*=10;
ans+=s[i];
}
}
return ans;
} vector<int> findnextstate(int state,int sum){
vector<int>ans; //cout<<"state="<<state<<" has next states:\n ";
vector<int> s;
while(state){
s.push_back(state%10);
state/=10;
}
reverse(s.begin(),s.end());
int n=s.size();
for(int i=0;i<n;i++){
if(s[i]==sum){
ans.push_back(link(s,i));
break;
}
} for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
if(s[i]+s[j]==sum){
ans.push_back(link(s,i,j));
break;
}
}
} for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
for(int k=j+1;k<n;k++){
if(s[i]+s[j]+s[k]==sum){
ans.push_back(link(s,i,j,k));
break;
}
}
}
} for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
for(int k=j+1;k<n;k++){
for(int l=k+1;l<n;l++){
if(s[i]+s[j]+s[k]+s[l]==sum){
ans.push_back(link(s,i,j,k,l));
break;
}
}
}
}
} for(auto i:ans){
cout<<i<<",";
}
cout<<endl;
return ans;
} void calc(int state){
double minans=0;
double maxans=0;
vector<int> ns;
for(int sum=2;sum<=12;sum++){
ns=findnextstate(state,sum);
if(ns.size()==0){
minans+=p[sum]*state;
maxans+=p[sum]*state;
}
else{
double nmax=-1.0;
double nmin=1e30;
for(auto nsi:ns){
nmax=max(nmax,dmax[nsi]);
nmin=min(nmin,dmin[nsi]);
} maxans+=p[sum]*nmax;
minans+=p[sum]*nmin;
}
} dmax[state]=maxans;
dmin[state]=minans; cerr<<"state="<<state<<" dmax="<<maxans<<" dmin="<<minans<<endl;
printf("dmax[%d]=%.10f;\ndmin[%d]=%.10f;\n",state,maxans,state,minans);
cout<<"dmax["<<state<<"]="<<maxans<<";\n";
cout<<"dmin["<<state<<"]="<<minans<<";\n";
} int ntop=511;
int main(){
freopen("Yinku.out","w",stdout); for(int sum=2;sum<=7;sum++){
p[sum]=1.0*(sum-1)/36;
}
for(int sum=8;sum<=12;sum++){
p[sum]=1.0*(13-sum)/36;
} for(int sum=2;sum<=12;sum++){
cout<<"p["<<sum<<"]="<<p[sum]<<endl;
} for(int i=0;i<ntop;i++){
calc(num[i]);
}
}*/ #include<bits/stdc++.h>
using namespace std;
map<int,double> dmax,dmin; void init(){
dmax[]=1.0000000000;
dmin[]=1.0000000000;
dmax[]=1.9444444444;
dmin[]=1.9444444444;
dmax[]=2.8333333333;
dmin[]=2.8333333333;
dmax[]=3.6666666667;
dmin[]=3.6666666667;
dmax[]=4.4444444444;
dmin[]=4.4444444444;
dmax[]=5.1666666667;
dmin[]=5.1666666667;
dmax[]=5.8333333333;
dmin[]=5.8333333333;
dmax[]=6.8888888889;
dmin[]=6.8888888889;
dmax[]=8.0000000000;
dmin[]=8.0000000000;
dmax[]=11.0277777778;
dmin[]=11.0277777778;
dmax[]=11.2500000000;
dmin[]=11.2500000000;
dmax[]=11.3611111111;
dmin[]=11.3611111111;
dmax[]=11.3611111111;
dmin[]=11.3611111111;
dmax[]=11.2500000000;
dmin[]=11.2500000000;
dmax[]=11.9722222222;
dmin[]=11.9722222222;
dmax[]=13.6388888889;
dmin[]=13.6388888889;
dmax[]=15.4166666667;
dmin[]=15.4166666667;
dmax[]=18.7145061728;
dmin[]=18.7145061728;
dmax[]=18.2638888889;
dmin[]=18.2638888889;
dmax[]=17.7006172840;
dmin[]=17.7006172840;
dmax[]=18.4691358025;
dmin[]=18.4691358025;
dmax[]=19.2361111111;
dmin[]=19.2361111111;
dmax[]=21.4614197531;
dmin[]=21.4614197531;
dmax[]=23.7993827160;
dmin[]=23.7993827160;
dmax[]=24.0509259259;
dmin[]=24.0509259259;
dmax[]=24.8672839506;
dmin[]=24.8672839506;
dmax[]=25.6805555556;
dmin[]=25.6805555556;
dmax[]=26.4907407407;
dmin[]=26.4907407407;
dmax[]=29.2762345679;
dmin[]=29.2762345679;
dmax[]=32.1759259259;
dmin[]=32.1759259259;
dmax[]=32.0277777778;
dmin[]=32.0277777778;
dmax[]=32.8842592593;
dmin[]=32.8842592593;
dmax[]=33.7361111111;
dmin[]=33.7361111111;
dmax[]=37.0833333333;
dmin[]=37.0833333333;
dmax[]=40.5462962963;
dmin[]=40.5462962963;
dmax[]=40.0802469136;
dmin[]=40.0802469136;
dmax[]=40.9722222222;
dmin[]=40.9722222222;
dmax[]=44.8827160494;
dmin[]=44.8827160494;
dmax[]=47.2716049383;
dmin[]=47.2716049383;
dmax[]=48.1990740741;
dmin[]=48.1990740741;
dmax[]=50.7854938272;
dmin[]=50.7854938272;
dmax[]=53.4351851852;
dmin[]=53.4351851852;
dmax[]=56.1250000000;
dmin[]=56.1250000000;
dmax[]=59.0370370370;
dmin[]=59.0370370370;
dmax[]=68.6265432099;
dmin[]=68.6265432099;
dmax[]=72.9483024691;
dmin[]=72.4930555556;
dmax[]=53.4598765432;
dmin[]=53.4598765432;
dmax[]=47.3634259259;
dmin[]=47.3634259259;
dmax[]=48.0941358025;
dmin[]=48.0941358025;
dmax[]=55.7924382716;
dmin[]=55.7924382716;
dmax[]=70.1481481481;
dmin[]=70.1481481481;
dmax[]=84.7322530864;
dmin[]=84.7322530864;
dmax[]=61.6057098765;
dmin[]=60.9737654321;
dmax[]=51.5339506173;
dmin[]=51.5339506173;
dmax[]=52.3125000000;
dmin[]=52.3125000000;
dmax[]=60.5864197531;
dmin[]=60.5864197531;
dmax[]=76.0979938272;
dmin[]=76.0979938272;
dmax[]=91.8425925926;
dmin[]=91.8425925926;
dmax[]=71.3016975309;
dmin[]=70.5331790123;
dmax[]=56.5061728395;
dmin[]=56.5061728395;
dmax[]=65.3541666667;
dmin[]=65.3541666667;
dmax[]=82.0262345679;
dmin[]=82.0262345679;
dmax[]=94.7970679012;
dmin[]=94.7970679012;
dmax[]=81.6242283951;
dmin[]=80.7638888889;
dmax[]=70.0956790123;
dmin[]=70.0956790123;
dmax[]=83.5439814815;
dmin[]=83.5439814815;
dmax[]=92.7901234568;
dmin[]=92.7901234568;
dmax[]=97.0331790123;
dmin[]=96.1304012346;
dmax[]=79.8456790123;
dmin[]=79.8456790123;
dmax[]=89.6550925926;
dmin[]=89.6550925926;
dmax[]=108.4174382716;
dmin[]=107.7114197531;
dmax[]=94.9969135802;
dmin[]=94.9969135802;
dmax[]=130.2307098765;
dmin[]=129.6041666667;
dmax[]=75.8672839506;
dmin[]=75.8672839506;
dmax[]=102.4124657064;
dmin[]=100.8269032922;
dmax[]=90.7445130316;
dmin[]=90.7445130316;
dmax[]=104.7986111111;
dmin[]=104.7986111111;
dmax[]=131.3254458162;
dmin[]=131.3254458162;
dmax[]=151.4512174211;
dmin[]=151.4512174211;
dmax[]=80.6995884774;
dmin[]=80.6995884774;
dmax[]=128.6604938272;
dmin[]=126.8414351852;
dmax[]=109.8263888889;
dmin[]=109.8263888889;
dmax[]=130.6715534979;
dmin[]=130.6715534979;
dmax[]=151.7037037037;
dmin[]=151.7037037037;
dmax[]=99.6547496571;
dmin[]=99.6547496571;
dmax[]=149.5511831276;
dmin[]=147.5733024691;
dmax[]=129.4416152263;
dmin[]=129.4416152263;
dmax[]=144.1989026063;
dmin[]=144.1989026063;
dmax[]=119.7229938272;
dmin[]=119.7229938272;
dmax[]=171.1649519890;
dmin[]=169.5565843621;
dmax[]=150.2122770919;
dmin[]=150.2122770919;
dmax[]=140.3369341564;
dmin[]=140.3369341564;
dmax[]=186.3179012346;
dmin[]=185.0694444444;
dmax[]=177.2290809328;
dmin[]=177.2290809328;
dmax[]=113.5054012346;
dmin[]=113.5054012346;
dmax[]=133.7564300412;
dmin[]=133.7564300412;
dmax[]=201.3310185185;
dmin[]=198.2947530864;
dmax[]=173.6041666667;
dmin[]=173.6041666667;
dmax[]=202.9302983539;
dmin[]=202.9302983539;
dmax[]=148.3471364883;
dmin[]=148.3471364883;
dmax[]=159.3734567901;
dmin[]=159.3734567901;
dmax[]=238.1693244170;
dmin[]=235.6723251029;
dmax[]=209.6433470508;
dmin[]=209.6433470508;
dmax[]=174.8269032922;
dmin[]=174.8269032922;
dmax[]=195.5067729767;
dmin[]=195.5067729767;
dmax[]=256.4344135802;
dmin[]=254.4699074074;
dmax[]=201.5748456790;
dmin[]=201.5748456790;
dmax[]=222.9701646091;
dmin[]=222.9701646091;
dmax[]=249.8924039781;
dmin[]=249.8924039781;
dmax[]=202.5902777778;
dmin[]=202.5902777778;
dmax[]=216.6087962963;
dmin[]=216.6087962963;
dmax[]=254.9200102881;
dmin[]=254.9200102881;
dmax[]=330.7530864198;
dmin[]=328.0833333333;
dmax[]=235.4837962963;
dmin[]=235.4837962963;
dmax[]=261.6674382716;
dmin[]=261.6674382716;
dmax[]=287.9881687243;
dmin[]=287.9881687243;
dmax[]=268.3657407407;
dmin[]=268.3657407407;
dmax[]=295.2870370370;
dmin[]=295.2870370370;
dmax[]=328.1095679012;
dmin[]=328.1095679012;
dmax[]=301.6936728395;
dmin[]=301.6936728395;
dmax[]=333.3815157750;
dmin[]=333.3815157750;
dmax[]=349.3172153635;
dmin[]=349.3172153635;
dmax[]=340.7096193416;
dmin[]=340.7096193416;
dmax[]=356.9629629630;
dmin[]=356.9629629630;
dmax[]=395.4831961591;
dmin[]=395.4831961591;
dmax[]=399.6203703704;
dmin[]=399.6203703704;
dmax[]=418.5442386831;
dmin[]=418.5442386831;
dmax[]=443.6514060357;
dmin[]=443.6514060357;
dmax[]=486.1234567901;
dmin[]=486.1234567901;
dmax[]=119.4546467764;
dmin[]=110.0102023320;
dmax[]=54.2540294925;
dmin[]=43.0411522634;
dmax[]=23.1703103567;
dmin[]=11.6005015432;
dmax[]=25.5880486968;
dmin[]=23.2014317558;
dmax[]=230.4202246228;
dmin[]=227.6310871056;
dmax[]=401.2454561043;
dmin[]=398.0474537037;
dmax[]=20.0291923868;
dmin[]=13.9230967078;
dmax[]=22.9655778464;
dmin[]=14.9202246228;
dmax[]=25.8203446502;
dmin[]=17.8825874486;
dmax[]=26.5225051440;
dmin[]=26.5225051440;
dmax[]=199.7329818244;
dmin[]=199.7329818244;
dmax[]=231.4379286694;
dmin[]=225.4654921125;
dmax[]=199.9688786008;
dmin[]=192.4221107682;
dmax[]=167.3787294239;
dmin[]=161.7572659465;
dmax[]=134.0133744856;
dmin[]=134.0133744856;
dmax[]=377.3278892318;
dmin[]=370.9889403292;
dmax[]=310.0932355967;
dmin[]=304.0210905350;
dmax[]=277.7365826475;
dmin[]=273.2816786694;
dmax[]=490.5290637860;
dmin[]=484.6957304527;
dmax[]=458.3088134431;
dmin[]=452.8862740055;
dmax[]=674.2302383402;
dmin[]=668.2459705075;
dmax[]=135.5098593964;
dmin[]=127.9563614540;
dmax[]=100.7694615912;
dmin[]=96.2972393690;
dmax[]=401.0482253086;
dmin[]=387.5869341564;
dmax[]=365.5969221536;
dmin[]=354.5354938272;
dmax[]=329.1183984911;
dmin[]=324.7734910837;
dmax[]=66.5548268176;
dmin[]=62.2280092593;
dmax[]=69.6111968450;
dmin[]=67.8202160494;
dmax[]=408.8004115226;
dmin[]=401.5396090535;
dmax[]=373.7729766804;
dmin[]=368.9358710562;
dmax[]=260.4957133059;
dmin[]=255.6905435528;
dmax[]=225.5781464335;
dmin[]=224.2401834705;
dmax[]=492.1507201646;
dmin[]=486.5778034979;
dmax[]=419.4829818244;
dmin[]=414.8127143347;
dmax[]=422.7452846365;
dmin[]=421.8224451303;
dmax[]=655.1735253772;
dmin[]=650.1018518519;
dmax[]=354.8067986968;
dmin[]=346.6737825789;
dmax[]=158.3001543210;
dmin[]=155.2708333333;
dmax[]=481.0778034979;
dmin[]=474.8007973251;
dmax[]=723.4605624143;
dmin[]=709.9681927298;
dmax[]=323.5196759259;
dmin[]=319.3485082305;
dmax[]=165.5367369684;
dmin[]=165.5367369684;
dmax[]=410.0457390261;
dmin[]=408.5901063100;
dmax[]=494.4687500000;
dmin[]=490.3422067901;
dmax[]=375.7253086420;
dmin[]=375.7253086420;
dmax[]=706.0543124143;
dmin[]=701.3932184499;
dmax[]=606.5264489026;
dmin[]=596.4591478052;
dmax[]=436.6946587791;
dmin[]=432.0253772291;
dmax[]=523.6325445816;
dmin[]=518.0709876543;
dmax[]=530.5990226337;
dmin[]=527.0187757202;
dmax[]=403.3052126200;
dmin[]=403.3052126200;
dmax[]=711.9952846365;
dmin[]=707.8954046639;
dmax[]=792.9756515775;
dmin[]=782.5008573388;
dmax[]=656.6616941015;
dmin[]=651.4583762003;
dmax[]=664.9979852538;
dmin[]=661.9764660494;
dmax[]=946.1225994513;
dmin[]=936.8689128944;
dmax[]=37.1956018519;
dmin[]=29.5484682213;
dmax[]=42.9060999657;
dmin[]=34.3794152949;
dmax[]=371.8075703018;
dmin[]=360.2605238340;
dmax[]=49.6303798011;
dmin[]=49.6303798011;
dmax[]=571.8996484911;
dmin[]=564.3588391632;
dmax[]=306.9124514175;
dmin[]=299.3814586191;
dmax[]=703.6003086420;
dmin[]=682.3596536351;
dmax[]=902.0576989026;
dmin[]=879.6421896433;
dmax[]=577.4717649749;
dmin[]=565.7200788752;
dmax[]=252.3318329904;
dmin[]=251.6157836077;
dmax[]=714.7542795496;
dmin[]=705.4843178441;
dmax[]=848.5984367856;
dmin[]=840.1232662704;
dmax[]=591.2397976680;
dmin[]=590.8206875857;
dmax[]=923.0631001372;
dmin[]=914.6124399863;
dmax[]=993.9987854367;
dmin[]=993.6945158893;
dmax[]=190.4747085048;
dmin[]=183.9033922039;
dmax[]=737.3722993827;
dmin[]=727.2996399177;
dmax[]=198.4930555556;
dmin[]=198.4930555556;
dmax[]=813.4903978052;
dmin[]=805.7591163695;
dmax[]=475.5123671125;
dmin[]=466.6498413923;
dmax[]=1294.8040123457;
dmin[]=1269.5820687586;
dmax[]=888.5467678326;
dmin[]=874.6962448560;
dmax[]=485.6350951646;
dmin[]=485.6350951646;
dmax[]=1104.2062757202;
dmin[]=1095.8524091221;
dmax[]=904.7705332647;
dmin[]=904.7705332647;
dmax[]=641.2331532922;
dmin[]=632.3825017147;
dmax[]=786.4277692044;
dmin[]=778.6418348003;
dmax[]=717.4419295839;
dmin[]=716.5374371285;
dmax[]=935.7325531550;
dmin[]=923.2384116369;
dmax[]=1363.7049039781;
dmin[]=1338.0081447188;
dmax[]=874.0416666667;
dmin[]=874.0416666667;
dmax[]=978.0735811043;
dmin[]=968.9724651349;
dmax[]=1054.1356310014;
dmin[]=1046.5969221536;
dmax[]=1279.2054040924;
dmin[]=1267.6953446502;
dmax[]=1254.6332304527;
dmin[]=1246.4920124600;
dmax[]=168.6016375171;
dmin[]=167.8963906036;
dmax[]=655.1168552812;
dmin[]=642.1845850480;
dmax[]=946.7671039095;
dmin[]=935.4454446731;
dmax[]=1142.3213305898;
dmin[]=1132.4689643347;
dmax[]=1145.1833419067;
dmin[]=1129.9692858368;
dmax[]=572.7495070302;
dmin[]=572.7495070302;
dmax[]=1249.2494427298;
dmin[]=1238.7290523548;
dmax[]=1446.8596965021;
dmin[]=1426.6103609396;
dmax[]=1546.8643689986;
dmin[]=1522.5447959534;
dmax[]=1361.1638803155;
dmin[]=1361.0275634431;
dmax[]=496.1508916324;
dmin[]=496.1508916324;
dmax[]=1488.6962162780;
dmin[]=1474.1989597622;
dmax[]=1392.6273719707;
dmin[]=1381.1784788904;
dmax[]=1402.0408521948;
dmin[]=1387.2846221994;
dmax[]=1204.1147976680;
dmin[]=1203.8704561043;
dmax[]=1903.6904435299;
dmin[]=1883.8273319616;
dmax[]=1039.7095764746;
dmin[]=1039.7095764746;
dmax[]=1655.0932784636;
dmin[]=1641.9003200732;
dmax[]=1863.1005515546;
dmin[]=1848.7299001677;
dmax[]=1500.8286179698;
dmin[]=1500.8286179698;
dmax[]=1141.9544324417;
dmin[]=1141.6019804527;
dmax[]=1274.9556327160;
dmin[]=1274.9556327160;
dmax[]=2039.4982853224;
dmin[]=2022.5546982167;
dmax[]=1539.4831532922;
dmin[]=1539.3751286008;
dmax[]=2180.6133401920;
dmin[]=2162.6604080933;
dmax[]=2566.9612482853;
dmin[]=2545.8911751257;
dmax[]=1585.1182913237;
dmin[]=1585.1182913237;
dmax[]=1847.5809327846;
dmin[]=1847.5809327846;
dmax[]=2112.5674296982;
dmin[]=2112.5674296982;
dmax[]=2166.8948902606;
dmin[]=2166.8948902606;
dmax[]=2244.1061814129;
dmin[]=2244.1061814129;
dmax[]=2401.0883058985;
dmin[]=2401.0883058985;
dmax[]=2722.0385230910;
dmin[]=2722.0385230910;
dmax[]=2782.1575788752;
dmin[]=2782.1575788752;
dmax[]=3261.3257887517;
dmin[]=3261.3257887517;
dmax[]=68.8936828418;
dmin[]=28.7180236435;
dmax[]=82.1975213382;
dmin[]=24.5750856148;
dmax[]=97.8553848022;
dmin[]=35.8737890089;
dmax[]=111.0048368198;
dmin[]=48.2685899634;
dmax[]=125.3670934309;
dmin[]=64.0274419867;
dmax[]=80.2201562738;
dmin[]=40.8158852976;
dmax[]=84.8537427602;
dmin[]=45.9317605929;
dmax[]=120.4383311424;
dmin[]=67.5882880373;
dmax[]=145.4804431489;
dmin[]=71.4257735101;
dmax[]=97.2667562109;
dmin[]=56.4173965954;
dmax[]=128.7155254534;
dmin[]=76.6345754029;
dmax[]=166.5252867322;
dmin[]=99.9029028064;
dmax[]=148.2070866198;
dmin[]=107.8061104443;
dmax[]=183.2486044429;
dmin[]=152.6676025949;
dmax[]=2258.1909436443;
dmin[]=2217.6901232186;
dmax[]=105.4605302641;
dmin[]=60.3787544296;
dmax[]=101.7739126086;
dmin[]=59.7399584191;
dmax[]=110.8298539666;
dmin[]=75.3271622799;
dmax[]=135.3230595565;
dmin[]=96.1446163885;
dmax[]=130.5791395176;
dmin[]=88.1089356139;
dmax[]=131.5596969784;
dmin[]=87.9305948503;
dmax[]=152.6949076456;
dmin[]=111.8062664323;
dmax[]=150.7718585677;
dmin[]=121.0528406493;
dmax[]=178.6185128029;
dmin[]=138.9066179412;
dmax[]=205.6409000629;
dmin[]=184.3991317063;
dmax[]=1219.8163258745;
dmin[]=1172.6707116389;
dmax[]=1212.2984479786;
dmin[]=1169.0029191196;
dmax[]=1209.8522066949;
dmin[]=1171.2606476718;
dmax[]=1238.1811199703;
dmin[]=1198.0754386717;
dmax[]=1239.3773148148;
dmin[]=1198.6230281207;
dmax[]=1265.9524891404;
dmin[]=1248.3427974013;
dmax[]=3057.8458397634;
dmin[]=2980.0848217688;
dmax[]=2696.2922525149;
dmin[]=2631.3414732891;
dmax[]=2726.7459455018;
dmin[]=2670.1675490112;
dmax[]=4566.0939429012;
dmin[]=4476.9786784598;
dmax[]=488.7487925812;
dmin[]=453.2097276997;
dmax[]=528.7718121285;
dmin[]=458.7735982510;
dmax[]=552.5490612140;
dmin[]=502.7671253429;
dmax[]=1312.8041266575;
dmin[]=1269.4899905693;
dmax[]=556.9534715078;
dmin[]=519.6793195588;
dmax[]=546.3390096308;
dmin[]=508.0636609797;
dmax[]=579.0787822931;
dmin[]=533.8523186252;
dmax[]=2482.9081575789;
dmin[]=2375.8243098422;
dmax[]=2478.6709533608;
dmin[]=2394.8990697874;
dmax[]=2500.0781107110;
dmin[]=2416.7810166133;
dmax[]=555.4991236092;
dmin[]=508.4235229957;
dmax[]=587.4293957667;
dmin[]=543.0868400873;
dmax[]=619.1480933737;
dmin[]=587.4807384545;
dmax[]=641.5332576017;
dmin[]=602.0972174592;
dmax[]=624.8926897577;
dmin[]=600.7332533150;
dmax[]=2946.9804169524;
dmin[]=2873.2640460677;
dmax[]=2141.9245791895;
dmin[]=2115.6638910322;
dmax[]=2196.7535008002;
dmin[]=2123.1369932175;
dmax[]=2228.1483243789;
dmin[]=2201.1028199303;
dmax[]=4162.9569687357;
dmin[]=4106.9212391404;
dmax[]=1443.1123221022;
dmin[]=1400.8586069673;
dmax[]=1482.3117462563;
dmin[]=1412.0010335696;
dmax[]=3545.0566772405;
dmin[]=3432.3871694483;
dmax[]=1502.5136674097;
dmin[]=1457.1131615798;
dmax[]=1541.2273662551;
dmin[]=1515.0383087563;
dmax[]=4818.8587534294;
dmin[]=4727.5581728205;
dmax[]=1534.3182513146;
dmin[]=1504.4821566358;
dmax[]=1547.0355366941;
dmin[]=1513.6037701475;
dmax[]=1598.6005670344;
dmin[]=1572.8882411218;
dmax[]=3676.3401277435;
dmin[]=3645.2802211934;
dmax[]=4280.0875878772;
dmin[]=4206.0998085277;
dmax[]=2980.3495846670;
dmin[]=2947.9075526787;
dmax[]=3011.6955947074;
dmin[]=2963.5740359701;
dmax[]=3946.9544753086;
dmin[]=3924.8462839125;
dmax[]=6517.5464749085;
dmin[]=6415.2605667010;
dmax[]=147.6400986892;
dmin[]=89.2601963782;
dmax[]=257.1858496228;
dmin[]=190.8584128753;
dmax[]=252.3629270024;
dmin[]=184.5396681940;
dmax[]=301.3552002362;
dmin[]=243.1498175774;
dmax[]=236.5152820645;
dmin[]=178.6969825246;
dmax[]=291.6070982891;
dmin[]=233.6940568559;
dmax[]=359.9126717059;
dmin[]=293.1627371971;
dmax[]=295.5584764613;
dmin[]=256.2226520824;
dmax[]=3669.4914694787;
dmin[]=3563.7280711782;
dmax[]=389.4286372599;
dmin[]=384.4475701589;
dmax[]=2251.1179483882;
dmin[]=2205.1296891670;
dmax[]=3017.6644173430;
dmin[]=2939.3314326343;
dmax[]=2338.7110990449;
dmin[]=2248.7861823443;
dmax[]=5695.9455101642;
dmin[]=5460.6340913637;
dmax[]=5676.9275882106;
dmin[]=5488.4613840306;
dmax[]=5710.2617574493;
dmin[]=5568.1564190863;
dmax[]=2381.4294815005;
dmin[]=2362.1686818098;
dmax[]=2478.9458257125;
dmin[]=2459.3707668896;
dmax[]=6466.6833875521;
dmin[]=6315.4665702690;
dmax[]=5845.0903730376;
dmin[]=5798.7655015591;
dmax[]=1719.2177652511;
dmin[]=1633.1462167543;
dmax[]=1780.9554374333;
dmin[]=1736.6722546503;
dmax[]=1832.7807022558;
dmin[]=1753.0964315653;
dmax[]=1792.3268354195;
dmin[]=1760.9091959114;
dmax[]=7407.7422458467;
dmin[]=7247.6857519814;
dmax[]=1901.1101156455;
dmin[]=1886.5162664165;
dmax[]=4649.3631794410;
dmin[]=4593.8993716421;
dmax[]=4677.8817443987;
dmin[]=4554.0368929565;
dmax[]=8830.5971626848;
dmin[]=8673.4565353033;
dmax[]=4766.5699255068;
dmin[]=4742.1305679393;
dmax[]=4162.2289320892;
dmin[]=4053.2304431489;
dmax[]=6341.0042771681;
dmin[]=6247.8671386793;
dmax[]=4929.2392308718;
dmin[]=4873.7036055331;
dmax[]=7872.9425678250;
dmin[]=7743.7882523942;
dmax[]=8231.5991750495;
dmin[]=8090.2792856621;
dmax[]=1422.0523524425;
dmin[]=1382.6826488912;
dmax[]=1505.6993181775;
dmin[]=1478.7650649514;
dmax[]=1656.4089029873;
dmin[]=1629.7378162628;
dmax[]=6436.6032438367;
dmin[]=6273.9314998190;
dmax[]=6505.9448302469;
dmin[]=6318.7160755792;
dmax[]=9454.9624938081;
dmin[]=9256.2829011711;
dmax[]=5516.1204811100;
dmin[]=5475.1114921506;
dmax[]=10468.7030749886;
dmin[]=10225.8148469650;
dmax[]=5634.7702939243;
dmin[]=5604.7104945416;
dmax[]=10562.7302240512;
dmin[]=10407.4795965268;
dmax[]=4804.0017730243;
dmin[]=4780.5669133103;
dmax[]=4844.1055098308;
dmin[]=4823.9204437205;
dmax[]=13897.8296983755;
dmin[]=13634.6802623668;
dmax[]=9971.1276339354;
dmin[]=9863.9338142369;
dmax[]=9292.2046039095;
dmin[]=9226.4675711591;
dmax[]=4854.2439021776;
dmin[]=4849.4561197321;
dmax[]=11383.0826188843;
dmin[]=11294.3846379172;
dmax[]=12726.1525396281;
dmin[]=12628.5057282934;
dmax[]=15397.3263460219;
dmin[]=15273.4797548964;
dmax[]=10532.2069901692;
dmin[]=10532.2069901692;
dmax[]=16021.8635211858;
dmin[]=16021.8635211858;
dmax[]=194.3717704920;
dmin[]=40.2302529599;
dmax[]=369.4698726772;
dmin[]=46.9140025657;
dmax[]=371.9810700779;
dmin[]=75.2925873136;
dmax[]=478.4578042441;
dmin[]=149.8941924159;
dmax[]=352.6189403808;
dmin[]=70.6543663353;
dmax[]=422.6110858077;
dmin[]=70.4962120641;
dmax[]=531.3186563675;
dmin[]=158.2084714932;
dmax[]=506.2029678212;
dmin[]=202.3029483128;
dmax[]=659.3351861378;
dmin[]=223.9294352598;
dmax[]=794.1044832073;
dmin[]=348.1515887494;
dmax[]=465.5540028858;
dmin[]=139.7917832939;
dmax[]=580.8660937315;
dmin[]=233.0884790862;
dmax[]=556.1440568029;
dmin[]=294.8483882295;
dmax[]=625.4961465398;
dmin[]=263.8479657123;
dmax[]=642.8518058096;
dmin[]=323.0687892682;
dmax[]=1020.9240737168;
dmin[]=499.9841627822;
dmax[]=756.9396216159;
dmin[]=361.4385244736;
dmax[]=804.2393221625;
dmin[]=434.8427317778;
dmax[]=1142.0635114746;
dmin[]=616.5431549698;
dmax[]=1358.7606006373;
dmin[]=910.0163939588;
dmax[]=590.9853454599;
dmin[]=285.2257360214;
dmax[]=684.3316508059;
dmin[]=300.4752586636;
dmax[]=829.7499158538;
dmin[]=453.6492028866;
dmax[]=648.5562656385;
dmin[]=398.7582965392;
dmax[]=904.3724744227;
dmin[]=419.5800738582;
dmax[]=952.4708516709;
dmin[]=607.1082081328;
dmax[]=986.5068496807;
dmin[]=580.5497240639;
dmax[]=995.7816625943;
dmin[]=617.0753063002;
dmax[]=1102.6942109916;
dmin[]=696.1225803332;
dmax[]=1293.8514094888;
dmin[]=975.4886042405;
dmax[]=11757.5867930527;
dmin[]=11452.5924467921;
dmax[]=11719.1314496223;
dmin[]=11389.9265688639;
dmax[]=11750.2670435782;
dmin[]=11461.0877875260;
dmax[]=12089.0516284675;
dmin[]=11781.1398258755;
dmax[]=26955.1883466221;
dmin[]=26097.8127519094;
dmax[]=4374.7485768572;
dmin[]=4104.8980572544;
dmax[]=4510.6907207759;
dmin[]=4132.7463151961;
dmax[]=4829.0138829351;
dmin[]=4404.0240757411;
dmax[]=4796.2065658658;
dmin[]=4409.9280139032;
dmax[]=5022.3018086674;
dmin[]=4406.8152915111;
dmax[]=5279.0935696016;
dmin[]=4884.9633739035;
dmax[]=4973.2614562892;
dmin[]=4627.3166211801;
dmax[]=5163.2132753360;
dmin[]=4727.1126293153;
dmax[]=5107.2382390446;
dmin[]=4820.0923381694;
dmax[]=24390.2699051450;
dmin[]=23491.1350201475;
dmax[]=5153.8803542000;
dmin[]=4766.2568523599;
dmax[]=5148.2828131880;
dmin[]=4740.6162474703;
dmax[]=5557.1326270740;
dmin[]=5175.4939360478;
dmax[]=5940.8348074798;
dmin[]=5593.7875913966;
dmax[]=21270.1288526663;
dmin[]=20884.8449715755;
dmax[]=13638.4393950760;
dmin[]=13416.0666316984;
dmax[]=14081.7711540416;
dmin[]=13539.5563146576;
dmax[]=14670.2829646776;
dmin[]=13898.5369767058;
dmax[]=14776.8501347927;
dmin[]=14279.5084507411;
dmax[]=14695.6440549507;
dmin[]=14392.6185539830;
dmax[]=29053.3553291017;
dmin[]=28658.3706208244;
dmax[]=967.0998273812;
dmin[]=483.5995414031;
dmax[]=1228.8454561439;
dmin[]=585.4682000727;
dmax[]=1309.6274611446;
dmin[]=684.7334850038;
dmax[]=1656.8527406132;
dmin[]=1072.5442687164;
dmax[]=2303.0647797539;
dmin[]=1699.1091981077;
dmax[]=2020.5296184101;
dmin[]=1376.3947773600;
dmax[]=1512.9856212174;
dmin[]=993.7750508813;
dmax[]=2155.2857464643;
dmin[]=1550.9985436486;
dmax[]=2371.7101970530;
dmin[]=1837.9024420639;
dmax[]=2599.4486582383;
dmin[]=2212.2162909062;
dmax[]=22162.2436144135;
dmin[]=21477.5099521866;
dmax[]=22132.4416141679;
dmin[]=21782.1836064513;
dmax[]=23003.4963691436;
dmin[]=22027.9335804827;
dmax[]=56340.2719353048;
dmin[]=54169.2986552350;
dmax[]=23532.3702786827;
dmin[]=23150.4181033376;
dmax[]=15810.8355875854;
dmin[]=15570.5119933829;
dmax[]=17081.2347066896;
dmin[]=16176.2199818953;
dmax[]=16940.1203366325;
dmin[]=16476.9611983621;
dmax[]=17635.1016233605;
dmin[]=17329.7402154884;
dmax[]=45681.4281547422;
dmin[]=44720.2818710083;
dmax[]=40643.2785623486;
dmin[]=39621.6045258978;
dmax[]=12759.7338033746;
dmin[]=12484.4791560161;
dmax[]=13894.7327532007;
dmin[]=13515.9984748498;
dmax[]=14749.8415659029;
dmin[]=14437.8743815606;
dmax[]=64063.9017266116;
dmin[]=61720.1351494760;
dmax[]=54323.2026290533;
dmin[]=53440.9330337675;
dmax[]=46896.1137450465;
dmin[]=46324.5863871398;
dmax[]=47400.8053412209;
dmin[]=47139.1641099976;
dmax[]=1298.6855006618;
dmin[]=187.6007245825;
dmax[]=1491.9750650953;
dmin[]=223.3673863063;
dmax[]=1724.2105056222;
dmin[]=282.2148528515;
dmax[]=2303.3924378041;
dmin[]=266.6182416817;
dmax[]=3192.9876480144;
dmin[]=344.0873728810;
dmax[]=2929.9214445610;
dmin[]=563.1113497477;
dmax[]=2548.9055060166;
dmin[]=434.3364947068;
dmax[]=3010.2953998723;
dmin[]=493.3574781930;
dmax[]=3453.9773810862;
dmin[]=569.0726610260;
dmax[]=4616.8603062479;
dmin[]=1626.5996866744;
dmax[]=3783.3213056337;
dmin[]=981.6508458749;
dmax[]=3717.6187803464;
dmin[]=1227.1752886146;
dmax[]=4609.1693726184;
dmin[]=1842.8698545044;
dmax[]=5467.0160719606;
dmin[]=2090.4682308705;
dmax[]=6793.0866956484;
dmin[]=2978.8418392789;
dmax[]=3919.1657507496;
dmin[]=2052.8523507892;
dmax[]=5521.3893153312;
dmin[]=2495.3251907094;
dmax[]=5737.9434120656;
dmin[]=2689.5499365372;
dmax[]=5924.6765386321;
dmin[]=3245.2574742723;
dmax[]=8213.9321715499;
dmin[]=4681.7779475531;
dmax[]=116672.3144780462;
dmin[]=112668.1486653372;
dmax[]=42111.7830760788;
dmin[]=40791.3714772151;
dmax[]=43518.5455490796;
dmin[]=40631.9199806627;
dmax[]=44863.7229470352;
dmin[]=40935.3891463184;
dmax[]=47349.6225536736;
dmin[]=42691.2014944134;
dmax[]=48770.4805365565;
dmin[]=45293.4864288149;
dmax[]=49207.0078391301;
dmin[]=46021.4548904976;
dmax[]=134381.6973255373;
dmin[]=132102.4887378579;
dmax[]=7069.0239066953;
dmin[]=3725.9974728167;
dmax[]=9321.9322390900;
dmin[]=4529.0369525895;
dmax[]=10266.3310179930;
dmin[]=4712.2985268626;
dmax[]=15134.4219958536;
dmin[]=9642.9386421078;
dmax[]=13294.5607577937;
dmin[]=8653.0856382868;
dmax[]=220712.4745010794;
dmin[]=213214.5674642164;
dmax[]=157137.1784207973;
dmin[]=153973.0654041489;
dmax[]=125797.0641292672;
dmin[]=123396.3259225896;
dmax[]=10581.3514556698;
dmin[]=1552.8631652257;
dmax[]=12609.0430973263;
dmin[]=1669.5084794961;
dmax[]=12888.2430275852;
dmin[]=1944.1378473185;
dmax[]=22216.2948490446;
dmin[]=2282.4925785500;
dmax[]=24032.8637932755;
dmin[]=3907.5529613813;
dmax[]=36149.6295980344;
dmin[]=8824.4798164677;
dmax[]=37637.2496743769;
dmin[]=18418.9426315879;
dmax[]=422754.5825671131;
dmin[]=404766.7612967730;
dmax[]=69551.1413956859;
dmin[]=34930.4199082499;
dmax[]=104798.3905297908;
dmin[]=14762.1738782474;
} double p[]; int link(vector<int> s,int ex1,int ex2=-,int ex3=-,int ex4=-){
int ans=;
int n=s.size();
for(int i=;i<n;i++){
if(i==ex1||i==ex2||i==ex3||i==ex4)
continue;
else{
ans*=;
ans+=s[i];
}
}
return ans;
} vector<int> findnextstate(int state,int sum){
vector<int>ans; //cout<<"state="<<state<<" has next states:\n ";
vector<int> s;
while(state){
s.push_back(state%);
state/=;
}
reverse(s.begin(),s.end());
int n=s.size();
for(int i=;i<n;i++){
if(s[i]==sum){
ans.push_back(link(s,i));
break;
}
} for(int i=;i<n;i++){
for(int j=i+;j<n;j++){
if(s[i]+s[j]==sum){
ans.push_back(link(s,i,j));
break;
}
}
} for(int i=;i<n;i++){
for(int j=i+;j<n;j++){
for(int k=j+;k<n;k++){
if(s[i]+s[j]+s[k]==sum){
ans.push_back(link(s,i,j,k));
break;
}
}
}
} for(int i=;i<n;i++){
for(int j=i+;j<n;j++){
for(int k=j+;k<n;k++){
for(int l=k+;l<n;l++){
if(s[i]+s[j]+s[k]+s[l]==sum){
ans.push_back(link(s,i,j,k,l));
break;
}
}
}
}
} /*for(auto i:ans){
cout<<i<<",";
}
cout<<endl;*/
return ans;
} int antilink(int state,int nstate){
vector<int> s;
while(state){
s.push_back(state%);
state/=;
}
reverse(s.begin(),s.end()); vector<int> ns;
while(nstate){
ns.push_back(nstate%);
nstate/=;
}
reverse(ns.begin(),ns.end()); int ans=;
int i=,j=; for(int i=;i<s.size();i++){
int notlink=;
for(int j=;j<ns.size();j++){
if(ns[j]==s[i]){
notlink=;
break;
} }
if(notlink==){
ans*=;
ans+=s[i];
}
}
return ans;
} void calc(int state,int sum){
double maxans=;
double minans=; int maxansnum=-;
int minansnum=-; vector<int> ns;
/*for(int sum=2;sum<=12;sum++)*/{
ns=findnextstate(state,sum);
if(ns.size()==){
minans+=state;
maxans+=state;
}
else{
double nmax=-1.0;
double nmin=1e30;
for(auto nsi:ns){
if(dmax[nsi]>nmax){
nmax=dmax[nsi];
maxansnum=antilink(state,nsi);
} if(dmin[nsi]<nmin){
nmin=dmin[nsi];
minansnum=antilink(state,nsi);
}
//nmax=max(nmax,dmax[nsi]);
//nmin=min(nmin,dmin[nsi]);
} maxans=nmax;
minans=nmin;
}
} //dmax[state]=maxans;
//dmin[state]=minans; //cerr<<"state="<<state<<" dmax="<<maxans<<" dmin="<<minans<<endl;
//printf("dmax[%d]=%.10f;\ndmin[%d]=%.10f;\n",state,maxans,state,minans);
//cout<<"dmax["<<state<<"]="<<maxans<<";\n";
//cout<<"dmin["<<state<<"]="<<minans<<";\n"; printf("%d %.5f\n",minansnum,minans);
printf("%d %.5f\n",maxansnum,maxans);
} int main(){
init();
for(int sum=;sum<=;sum++){
p[sum]=1.0*(sum-)/;
}
for(int sum=;sum<=;sum++){
p[sum]=1.0*(-sum)/;
} int state,a,b;
while(cin>>state>>a>>b){
calc(state,a+b);
}
}

dalao的代码:复杂度真的过关吗?

#include <bits/stdc++.h>
using namespace std;
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
typedef long long ll;
typedef long double ld;
int sumb[ << ], score[ << ];
ld mindp[ << ], maxdp[ << ];
char BS[];
int main() {
for (int i = ; i < ( << ); ++i)
for (int j = ; j < ; ++j)
if (i & ( << j)) {
sumb[i] += j + ;
score[i] = score[i] * + (j + );
}
int r1, r2;
scanf("%s%d%d", BS, &r1, &r2);
int B = ;
for (int i = ; i < strlen(BS); ++i)
B |= << (BS[i] - '');
int tot = r1 + r2;
for (int b = ; b < ( << ); ++b) {
for (int i = ; i <= ; ++i)
for (int j = ; j <= ; ++j) {
int sum = i + j;
// try all subsets that sum to sum
ld mn = 1e15;
ld mx = -1e15;
bool has = false;
for (int bb = b; bb; bb = (bb - ) & b) {
if (sumb[bb] == sum) {
mn = min(mn, mindp[b ^ bb]);
mx = max(mx, maxdp[b ^ bb]);
has = true;
}
}
if (!has) {
mindp[b] += score[b] / .L;
maxdp[b] += score[b] / .L;
} else {
mindp[b] += mn / ;
maxdp[b] += mx / ;
}
}
}
bool has = false;
ld mn = 1e15;
ld mx = -1e15;
int mnset, mxset;
for (int bb = B; bb; bb = (bb - ) & B) {
if (sumb[bb] == tot) {
if (mn > mindp[B ^ bb]) {
mnset = bb;
mn = mindp[B ^ bb];
}
if (mx < maxdp[B ^ bb]) {
mxset = bb;
mx = maxdp[B ^ bb];
}
has = true;
}
}
auto calc = [&](int bb) {
int ret = ;
for (int i = ; i < ; ++i)
if (bb & ( << i)) ret = ret * + (i + );
return ret;
};
printf("%d %.5Lf\n", has ? calc(mnset) : -, has ? mn : calc(B));
printf("%d %.5Lf\n", has ? calc(mxset) : -, has ? mx : calc(B));
}

K的更多相关文章

  1. django模型操作

    Django-Model操作数据库(增删改查.连表结构) 一.数据库操作 1.创建model表        

  2. 基于改进人工蜂群算法的K均值聚类算法(附MATLAB版源代码)

    其实一直以来也没有准备在园子里发这样的文章,相对来说,算法改进放在园子里还是会稍稍显得格格不入.但是最近邮箱收到的几封邮件让我觉得有必要通过我的博客把过去做过的东西分享出去更给更多需要的人.从论文刊登 ...

  3. 【开源】专业K线绘制[K线主副图、趋势图、成交量、滚动、放大缩小、MACD、KDJ等)

    这是一个iOS项目雅黑深邃的K线的绘制. 实现功能包括K线主副图.趋势图.成交量.滚动.放大缩小.MACD.KDJ,长按显示辅助线等功能 预览图 最后的最后,这是项目的开源地址:https://git ...

  4. 找到第k个最小元----快速选择

    此算法借用快速排序算法. 这个快速选择算法主要利用递归调用,数组存储方式.包含3个文件,头文件QuickSelect.h,库函数QuickSelect.c,测试文件TestQuickSelect. 其 ...

  5. BZOJ 3110: [Zjoi2013]K大数查询 [树套树]

    3110: [Zjoi2013]K大数查询 Time Limit: 20 Sec  Memory Limit: 512 MBSubmit: 6050  Solved: 2007[Submit][Sta ...

  6. 二次剩余、三次剩余、k次剩余

    今天研究了一下这块内容...首先是板子 #include <iostream> #include <stdio.h> #include <math.h> #incl ...

  7. [LeetCode] Longest Substring with At Least K Repeating Characters 至少有K个重复字符的最长子字符串

    Find the length of the longest substring T of a given string (consists of lowercase letters only) su ...

  8. K近邻法(KNN)原理小结

    K近邻法(k-nearst neighbors,KNN)是一种很基本的机器学习方法了,在我们平常的生活中也会不自主的应用.比如,我们判断一个人的人品,只需要观察他来往最密切的几个人的人品好坏就可以得出 ...

  9. YYStock开源----iOS股票K线绘制第二版

    新的股票绘制粗来啦,欢迎围观star的说(*^__^*) 嘻嘻-- 捏合功能也准备完善了 Github:https://github.com/yate1996/YYStock 长按分时图+五档图 分时 ...

  10. k近邻算法(knn)的c语言实现

    最近在看knn算法,顺便敲敲代码. knn属于数据挖掘的分类算法.基本思想是在距离空间里,如果一个样本的最接近的k个邻居里,绝大多数属于某个类别,则该样本也属于这个类别.俗话叫,"随大流&q ...

随机推荐

  1. 天下文章一大抄 之 修改excel 创建时间

    Sub ChangeDate()ThisWorkbook.BuiltinDocumentProperties("Creation Date") = #2 28 2016 13:25 ...

  2. Ikki&#39;s Story IV - Panda&#39;s Trick (poj 3207 2-SAT)

    Language: Default Ikki's Story IV - Panda's Trick Time Limit: 1000MS   Memory Limit: 131072K Total S ...

  3. Struts2实现空表单信息的提示

    须要的jar包文件: index.jsp源代码: <%@ page language="java" contentType="text/html; charset= ...

  4. ShopMall

    https://github.com/KingsleyYau/ShopMall-Android https://github.com/KingsleyYau/ShopMall-iOS https:// ...

  5. BEGINNING SHAREPOINT&#174; 2013 DEVELOPMENT 第8章节--配送SP2013Apps 应用程序生命周期

    BEGINNING SHAREPOINT® 2013 DEVELOPMENT 第8章节--配送SP2013Apps 应用程序生命周期         你在商店拥有一个应用程序后.跟踪不论什么人们碰到的 ...

  6. mysql 查询正在执行的事务以及等待锁 常用的sql语句

    使用navicat测试学习: 首先使用set autocommit = 0;(取消自动提交,则当执行语句commit或者rollback执行提交事务或者回滚)   在打开一个执行update查询 正在 ...

  7. linux安装jdk tomcat nginx 以及常用命令

    linux: 操作系统,应用服务器上 常用命令: cd 切换命令 cd / cd ~ cd ../../ cd xx ll 展示所有的文件 ll -h 友好的展示 mkdir 创建目录 mkdir 目 ...

  8. putty software caused connection abort

    错误现象:在非常短的时间内就失去连接.并报"Software caused connection abort" 解决的方法:首先得排除是网络不是不通畅.假设在局域网中要确定IP没有 ...

  9. app直播原理

    之前写的一系列文章或者小经验一直没有时间去整理放在博客上,今天整理出来,之前是写在作业部落,语法是markdown,点击链接浏览,仅供参考,希望对你有帮助. https://www.zybuluo.c ...

  10. hadoop-client

    <!-- https://mvnrepository.com/artifact/org.apache.hadoop/hadoop-common --> <dependency> ...