123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928 |
- using System;
- using System.Collections.Generic;
- using System.Web;
- using System.Linq;
- using System.Text;
- namespace CP.Common
- {
-
-
-
- public class ZstUtils
- {
- #region 快乐扑克3号码形态
-
-
-
-
-
-
- public static string GetTcsdKlpk3Hmxt(List<int> kjh, List<int> hs)
- {
- kjh.Sort();
- if (hs[0] == hs[1] && hs[1] == hs[2])
- {
- if (Math.Abs(kjh[2] - kjh[1]) == 1 && Math.Abs(kjh[1] - kjh[0]) == 1)
- return "同花顺";
- else
- return "同花";
- }
- else
- {
- if (Math.Abs(kjh[2] - kjh[1]) == 1 && Math.Abs(kjh[1] - kjh[0]) == 1)
- return "顺子";
- else if (kjh[0] == kjh[1] && kjh[1] == kjh[2])
- return "豹子";
- else if (kjh[0] != kjh[1] && kjh[0] != kjh[2] && kjh[1] != kjh[2])
- return "散牌";
- else
- return "对子";
- }
- }
- #endregion
- #region 获取山西泳坛夺金组选形态
-
-
-
-
-
- public static int GetYtdjZxxt(List<int> kjh)
- {
- Dictionary<int, int> hmCount = new Dictionary<int, int>();
- for (var i = 0; i < kjh.Count; i++)
- {
- var cur = kjh[i];
- for (var j = i + 1; j < kjh.Count; j++)
- {
- var hm = kjh[j];
- if (hm == cur)
- {
- if (hmCount.Keys.Contains(hm))
- {
- hmCount[hm]++;
- }
- else
- {
- hmCount.Add(hm, 1);
- }
- }
- }
- }
- if (hmCount.Count == 0)
- return 3;
- else if (hmCount.Count == 1)
- {
- if (hmCount.ElementAt(0).Value == 6)
- return 6;
- else if (hmCount.ElementAt(0).Value == 3)
- return 0;
- else if (hmCount.ElementAt(0).Value == 1)
- return 2;
- }
- return 1;
- }
- #endregion
- #region 大小相关方法
-
-
-
-
-
-
- public static int GetDxBymiddle(int n, int middle)
- {
- int r = 1;
- if (n < middle)
- r = 0;
- return r;
- }
-
-
-
-
-
-
-
- public static int GetDx(int n)
- {
- return GetDxBymiddle(n, 5);
- }
-
-
-
-
-
-
- public static string Getdxxt(List<int> kjh, int middle)
- {
- StringBuilder result = new StringBuilder();
- int size = kjh.Count;
- for (int i = 0; i < size; i++)
- {
- if (GetDxBymiddle(kjh[i], middle) == 1)
- result.Append("大");
- else
- result.Append("小");
- }
- return result.ToString();
- }
-
-
-
-
-
-
- public static string GetDxxt(List<int> kjh, bool istyle = true)
- {
- StringBuilder result = new StringBuilder();
- int size = kjh.Count;
- for (int i = 0; i < size; i++)
- {
- if (istyle)
- {
- if (kjh[i] > 4)
- result.Append("<span class=\"wz1\">大</span>");
- else
- result.Append("<span class=\"wz2\">小</span>");
- }
- else
- {
- if (kjh[i] > 4)
- result.Append("大");
- else
- result.Append("小");
- }
- }
- return result.ToString();
- }
-
-
-
-
-
-
- public static string GetDxxtByMiddle(List<int> kjh, int middle, bool istyle = true)
- {
- StringBuilder result = new StringBuilder();
- int size = kjh.Count;
- for (int i = 0; i < size; i++)
- {
- if (istyle)
- {
- if (kjh[i] >= middle)
- result.Append("<span class=\"wz1\">大</span>");
- else
- result.Append("<span class=\"wz2\">小</span>");
- }
- else
- {
- if (kjh[i] >= middle)
- result.Append("大");
- else
- result.Append("小");
- }
- }
- return result.ToString();
- }
-
-
-
-
-
-
-
- public static string GetDxxt(int num, bool istyle = true)
- {
- List<int> kjh = GetNumList(num);
- StringBuilder result = new StringBuilder();
- int size = kjh.Count;
- for (int i = 0; i < size; i++)
- {
- if (istyle)
- {
- if (kjh[i] > 4)
- result.Append("<span class=\"wz1\">大</span>");
- else
- result.Append("<span class=\"wz2\">小</span>");
- }
- else
- {
- if (kjh[i] > 4)
- result.Append("大");
- else
- result.Append("小");
- }
- }
- return result.ToString();
- }
-
-
-
-
-
- public static string GetDf61Dxb(List<int> list)
- {
- return GetDxb(list, 5);
- }
-
-
-
-
-
- public static string Get22x5Dxb(List<int> list)
- {
- return GetDxb(list, 12);
- }
-
-
-
-
-
- public static string Get25x5Dxb(List<int> list)
- {
- return GetDxb(list, 13);
- }
-
-
-
-
-
- public static string Get26x5Dxb(List<int> list)
- {
- return GetDxb(list, 14);
- }
-
-
-
-
-
- public static string Get25x7Dxb(List<int> list)
- {
- return GetDxb(list, 13);
- }
-
-
-
-
-
- public static string Get24x7Dxb(List<int> list)
- {
- return GetDxb(list, 12);
- }
-
-
-
-
-
- public static string Get20x5Dxb(List<int> list)
- {
- return GetDxb(list, 11);
- }
-
-
-
-
-
- public static string Get18x7Dxb(List<int> list)
- {
- return GetDxb(list, 10);
- }
-
-
-
-
-
-
- public static string Get30x5Dxxt(List<int> kjh, bool istyle = true)
- {
- StringBuilder result = new StringBuilder();
- int size = kjh.Count;
- for (int i = 0; i < size; i++)
- {
- if (istyle)
- {
- if (GetDxBymiddle(kjh[i], 16) == 1)
- result.Append("<span class=\"wz1\">大</span>");
- else
- result.Append("<span class=\"wz2\">小</span>");
- }
- else
- {
- if (GetDxBymiddle(kjh[i], 12) == 1)
- result.Append("大");
- else
- result.Append("小");
- }
- }
- return result.ToString();
- }
-
-
-
-
-
-
- public static string Get22x5Dxxt(List<int> kjh, bool istyle = true)
- {
- StringBuilder result = new StringBuilder();
- int size = kjh.Count;
- for (int i = 0; i < size; i++)
- {
- if (istyle)
- {
- if (GetDxBymiddle(kjh[i], 12) == 1)
- result.Append("<span class=\"wz1\">大</span>");
- else
- result.Append("<span class=\"wz2\">小</span>");
- }
- else
- {
- if (GetDxBymiddle(kjh[i], 12) == 1)
- result.Append("大");
- else
- result.Append("小");
- }
- }
- return result.ToString();
- }
-
-
-
-
-
-
- public static string Get20x5Dxxt(List<int> kjh, bool istyle = true)
- {
- StringBuilder result = new StringBuilder();
- int size = kjh.Count;
- for (int i = 0; i < size; i++)
- {
- if (istyle)
- {
- if (GetDxBymiddle(kjh[i], 11) == 1)
- result.Append("<span class=\"wz1\">大</span>");
- else
- result.Append("<span class=\"wz2\">小</span>");
- }
- else
- {
- if (GetDxBymiddle(kjh[i], 11) == 1)
- result.Append("大");
- else
- result.Append("小");
- }
- }
- return result.ToString();
- }
-
-
-
-
-
- public static int GetHc1Dx(int n)
- {
- return GetDxBymiddle(n, 19);
- }
-
-
-
-
-
- public static string GetQlcDxb(string[] kjh)
- {
- string bz = string.Empty;
- if (kjh != null && kjh.Length > 0)
- {
- int d = 0;
- int x = 0;
- for (int i = 0; i < kjh.Length; i++)
- {
- if (TypeConverter.StrToInt(kjh[i], 0) > 15)
- d++;
- else
- x++;
- }
- bz = d.ToString() + ":" + x.ToString();
- }
- return bz;
- }
-
-
-
-
-
- public static string GetQlcDxb(List<int> list)
- {
- return GetDxb(list, 16);
- }
-
-
-
-
-
- public static int Get7hwhz(int n)
- {
- return GetDxBymiddle(n, 33);
- }
-
-
-
-
-
- public static int GetP5HzDx(int n)
- {
- return GetDxBymiddle(n, 23);
- }
-
-
-
-
-
- public static int Get15x5Dx(int n)
- {
- return GetDxBymiddle(n, 8);
- }
-
-
-
-
-
- public static int Get11x5Dx(int n)
- {
- return GetDxBymiddle(n, 6);
- }
-
-
-
-
-
- public static string Get11x5Dxxt(List<int> kjh)
- {
- string xt = string.Empty;
- if (kjh != null && kjh.Count > 0)
- {
- foreach (int i in kjh)
- {
- if (Get11x5Dx(i) == 1)
- xt = xt + "大";
- else
- xt = xt + "小";
- }
- }
- return xt;
- }
-
-
-
-
-
- public static int GetQxcHzDx(int n)
- {
- return GetDxBymiddle(n, 33);
- }
-
-
-
-
-
- public static int GetHzDx(int n)
- {
- return GetDxBymiddle(n, 14);
- }
-
-
-
-
-
- public static string GetTcfj36x7DXB(List<int> list)
- {
- return GetDxb(list, 19);
- }
-
-
-
-
-
- public static string GetTcfj31x7DXB(List<int> list)
- {
- return GetDxb(list, 16);
- }
-
-
-
-
-
- public static string GetDltHqDxt(string[] kjh)
- {
- string bz = string.Empty;
- if (kjh != null && kjh.Length > 0)
- {
- int d = 0;
- int x = 0;
- for (int i = 0; i < kjh.Length; i++)
- {
- if (GetDxBymiddle(TypeConverter.StrToInt(kjh[i], 0), 7) == 1)
- d++;
- else
- x++;
- }
- bz = d.ToString() + ":" + x.ToString();
- }
- return bz;
- }
-
-
-
-
-
- public static string GetDltDxb(string[] kjh)
- {
- string bz = string.Empty;
- if (kjh != null && kjh.Length > 0)
- {
- int d = 0;
- int x = 0;
- for (int i = 0; i < kjh.Length; i++)
- {
- if (GetDxBymiddle(TypeConverter.StrToInt(kjh[i], 0), 18) == 1)
- d++;
- else
- x++;
- }
- bz = d.ToString() + ":" + x.ToString();
- }
- return bz;
- }
-
-
-
-
-
- public static string GetSSqDxb(string[] kjh)
- {
- string bz = string.Empty;
- if (kjh != null && kjh.Length > 0)
- {
- int d = 0;
- int x = 0;
- for (int i = 0; i < kjh.Length; i++)
- {
- if (GetDxBymiddle(TypeConverter.StrToInt(kjh[i], 0), 17) == 1)
- d++;
- else
- x++;
- }
- bz = d.ToString() + ":" + x.ToString();
- }
- return bz;
- }
-
-
-
-
-
- public static string GetSsqDxb(List<int> list)
- {
- return GetDxb(list, 17);
- }
-
-
-
-
-
- public static string GetDltDxb(List<int> list)
- {
- return GetDxb(list, 18);
- }
-
-
-
-
-
- public static string GetHd15x5Dxb(List<int> kjh)
- {
- return GetDxb(kjh, 7);
- }
-
-
-
-
-
-
- public static string GetHd15x5Dxxt(List<int> kjh, bool istyle = true)
- {
- StringBuilder result = new StringBuilder();
- int size = kjh.Count;
- for (int i = 0; i < size; i++)
- {
- if (istyle)
- {
- if (GetDxBymiddle(kjh[i], 8) == 1)
- result.Append("<span class=\"wz1\">大</span>");
- else
- result.Append("<span class=\"wz2\">小</span>");
- }
- else
- {
- if (GetDxBymiddle(kjh[i], 8) == 1)
- result.Append("大");
- else
- result.Append("小");
- }
- }
- return result.ToString();
- }
-
-
-
-
-
- public static string GetGd11x5Dxb(List<int> kjh)
- {
- return GetDxb(kjh, 6);
- }
-
-
-
-
-
- public static string GetHb11x5Dxb(List<int> kjh)
- {
- return GetDxb(kjh, 6);
- }
-
-
-
-
-
-
- public static string GetDxb(List<int> kjh, int middle)
- {
- int d = 0;
- int x = 0;
- for (int i = 0; i < kjh.Count; i++)
- {
- if (GetDxBymiddle(kjh[i], middle) == 1)
- d++;
- else
- x++;
- }
- return d.ToString() + ":" + x.ToString();
- }
-
-
-
-
-
- public static string GetDxb(int num)
- {
- List<int> kjh = GetNumList(num);
- return GetDxb(kjh, 5);
- }
- #endregion
- #region 012路相关方法
-
-
-
-
-
- public static string Get012Xt(List<int> k)
- {
- StringBuilder xt = new StringBuilder();
- for (int i = 0; i < k.Count; i++)
- {
- xt.Append(Get012(k[i]));
- }
- return xt.ToString();
- }
-
-
-
-
-
-
- public static int Get012(int n)
- {
- return n % 3;
- }
-
-
-
-
-
-
-
- public static int GetSpj(int hw, int uphw = 0, int i = 0)
- {
- if (i == 0)
- return 1;
- else
- {
- if (hw > uphw)
- return 0;
- else if (hw == uphw)
- return 1;
- else
- return 2;
- }
- }
-
-
-
-
-
- public static string GetCommon012b(List<int> list)
- {
- string bz = string.Empty;
- if (list != null && list.Count > 0)
- {
- int a = 0;
- int b = 0;
- int c = 0;
- for (int i = 0; i < list.Count; i++)
- {
- if (Get012(list[i]) == 0)
- a++;
- if (Get012(list[i]) == 1)
- b++;
- if (Get012(list[i]) == 2)
- c++;
- }
- bz = a.ToString() + ":" + b.ToString() + ":" + c.ToString();
- }
- return bz;
- }
-
-
-
-
-
-
-
-
- public static int Get012Count(int n, List<int> k)
- {
- int count = 0;
- for (int i = 0; i < k.Count; i++)
- {
- if (k[i] % 3 == n)
- count++;
- }
- return count;
- }
- #endregion
- #region 质合相关方法
-
-
-
-
-
- public static int GetZh(int n)
- {
-
- List<int> zs = new List<int> { 1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97 };
- if (zs.Contains(n))
- return 1;
- else
- return 0;
- }
-
-
-
-
-
- public static string GetZhb(List<int> kjh)
- {
- string bz = string.Empty;
- if (kjh != null && kjh.Count > 0)
- {
- int h = 0;
- int z = 0;
- for (int i = 0; i < kjh.Count; i++)
- {
- if (GetZh(kjh[i]) == 0)
- h++;
- else
- z++;
- }
- bz = z.ToString() + ":" + h.ToString();
- }
- return bz;
- }
-
-
-
-
-
- public static string GetZhb(string[] kjh)
- {
- string bz = string.Empty;
- if (kjh != null && kjh.Length > 0)
- {
- int z = 0;
- int h = 0;
- for (int i = 0; i < kjh.Length; i++)
- {
- if (GetZh(TypeConverter.StrToInt(kjh[i], 0)) == 1)
- z++;
- if (GetZh(TypeConverter.StrToInt(kjh[i], 0)) == 0)
- h++;
- }
- bz = z.ToString() + ":" + h.ToString();
- }
- return bz;
- }
-
-
-
-
-
-
- public static string GetZhxt(List<int> kjh, bool istyle = true)
- {
- StringBuilder result = new StringBuilder();
- for (int i = 0; i < kjh.Count; i++)
- {
- if (istyle)
- {
- if (GetZh(kjh[i]) == 0)
- result.Append("<span class=\"wz3\">合</span>");
- else
- result.Append("<span class=\"wz4\">质</span>");
- }
- else
- {
- if (GetZh(kjh[i]) == 0)
- result.Append("合");
- else
- result.Append("质");
- }
- }
- return result.ToString();
- }
-
-
-
-
-
-
- public static string GetZhxt(int num, bool istyle = true)
- {
- List<int> kjh = GetNumList(num);
- StringBuilder result = new StringBuilder();
- for (int i = 0; i < kjh.Count; i++)
- {
- if (istyle)
- {
- if (GetZh(kjh[i]) == 0)
- result.Append("<span class=\"wz3\">合</span>");
- else
- result.Append("<span class=\"wz4\">质</span>");
- }
- else
- {
- if (GetZh(kjh[i]) == 0)
- result.Append("合");
- else
- result.Append("质");
- }
- }
- return result.ToString();
- }
- #endregion
- #region 奇偶相关方法
-
-
-
-
-
-
-
- public static int GetJo(int n)
- {
- if (n % 2 == 0)
- return 0;
- else
- return 1;
- }
-
-
-
-
-
- public static string GetJob(List<int> kjh)
- {
- int j = 0;
- int o = 0;
- for (int i = 0; i < kjh.Count; i++)
- {
- if (GetJo(kjh[i]) == 0)
- o++;
- else
- j++;
- }
- return j.ToString() + ":" + o.ToString();
- }
-
-
-
-
-
- public static string GetJob(string[] kjh)
- {
- string bz = string.Empty;
- if (kjh != null && kjh.Length > 0)
- {
- int j = 0;
- int o = 0;
- for (int i = 0; i < kjh.Length; i++)
- {
- if (GetJo(TypeConverter.StrToInt(kjh[i], 0)) == 0)
- o++;
- else
- j++;
- }
- bz = j.ToString() + ":" + o.ToString();
- }
- return bz;
- }
-
-
-
-
-
- public static string GetJob(int num)
- {
- List<int> kjh = GetNumList(num);
- return GetJob(kjh);
- }
-
-
-
-
-
-
-
- public static string GetJoxt(int num, bool istyle = true)
- {
- List<int> kjh = GetNumList(num);
- StringBuilder result = new StringBuilder();
- for (int i = 0; i < kjh.Count; i++)
- {
- if (istyle)
- {
- if (GetJo(kjh[i]) == 0)
- result.Append("<span class=\"wz3\">偶</span>");
- else
- result.Append("<span class=\"wz4\">奇</span>");
- }
- else
- {
- if (GetJo(kjh[i]) == 0)
- result.Append("偶");
- else
- result.Append("奇");
- }
- }
- return result.ToString();
- }
-
-
-
-
-
-
- public static string GetJoxt(List<int> kjh, bool istyle = true)
- {
- StringBuilder result = new StringBuilder();
- for (int i = 0; i < kjh.Count; i++)
- {
- if (istyle)
- {
- if (GetJo(kjh[i]) == 0)
- result.Append("<span class=\"wz3\">偶</span>");
- else
- result.Append("<span class=\"wz4\">奇</span>");
- }
- else
- {
- if (GetJo(kjh[i]) == 0)
- result.Append("偶");
- else
- result.Append("奇");
- }
- }
- return result.ToString();
- }
-
-
-
-
-
-
- public static string GetDltHqJoxt(int n6, int n7)
- {
- string n6jo = "奇";
- string n7jo = "奇";
- if (n6 % 2 == 0)
- n6jo = "偶";
- if (n7 % 2 == 0)
- n7jo = "偶";
- return (n6jo + n7jo).ToString().Trim();
- }
- #endregion
- #region 重号/连号个数/连号对数
-
-
-
-
-
-
-
- public static int GetChCount(List<int> kjh1, List<int> kjh2)
- {
- return kjh1.Intersect(kjh2).ToList().Count;
- }
-
-
-
-
-
- public static int GetGd11x5LhCount(List<int> _kjh)
- {
- int c = 0;
- List<int> kjh = new List<int>(_kjh);
- if (kjh != null && kjh.Count > 0)
- {
- kjh.Sort();
- for (int i = 0; i < kjh.Count; i++)
- {
- if (i > 0 && (kjh[i] - kjh[i - 1] == 1))
- c++;
- }
- if (kjh[kjh.Count - 1] - kjh[0] == 10)
- c++;
- if (c > 0)
- c = c + 1;
- }
- return c;
- }
- public static int GetGd11x5LhDsCount(List<int> _kjh)
- {
- int c = 0;
- List<int> kjh = new List<int>(_kjh);
- if (kjh.Count > 0)
- {
- kjh.Sort();
- for (int i = 0; i < kjh.Count; i++)
- {
- if (i > 0 && (kjh[i] - kjh[i - 1]) == 1)
- c++;
- }
- if (kjh[kjh.Count - 1] - kjh[0] == 10)
- c++;
- }
- return c;
- }
-
-
-
-
-
- public static int GetGd11x5Xt(List<int> kjh)
- {
- int c = 0;
- if (kjh != null && kjh.Count > 0)
- {
- if (kjh[0] < kjh[1] && kjh[1] < kjh[2])
- c = 1;
- else if (kjh[0] > kjh[1] && kjh[1] > kjh[2])
- c = 2;
- else if (kjh[1] > kjh[0] && kjh[1] > kjh[2])
- c = 3;
- else if (kjh[0] > kjh[1] && kjh[1] < kjh[2])
- c = 4;
- }
- return c;
- }
-
-
-
-
-
-
- public static int GetLhCount(List<int> _kjh)
- {
- int c = 0;
- List<int> kjh = new List<int>(_kjh);
- if (kjh != null && kjh.Count > 0)
- {
- kjh.Sort();
- for (int i = 0; i < kjh.Count; i++)
- {
- if (i > 0 && (kjh[i] - kjh[i - 1]) == 1)
- c++;
- }
- if (c > 0)
- c = c + 1;
- }
- return c;
- }
-
-
-
-
-
-
- public static Dictionary<int, int> GetLhCountGp(List<int> _kjh)
- {
- Dictionary<int, int> dic = new Dictionary<int, int>();
- List<int> kjh = new List<int>(_kjh);
- if (kjh != null && kjh.Count > 0)
- {
- kjh.Sort();
- for (int i = 0; i < kjh.Count; i++)
- {
- if (i > 0 && (kjh[i] - kjh[i - 1]) == 1)
- {
- if (dic.Keys.Contains(i - 1))
- {
- dic.Add(i, dic[i - 1] + 1);
- dic.Remove(i - 1);
- }
- else
- {
- dic.Add(i, 2);
- }
- }
- }
- }
- if (dic.Count == 0)
- dic.Add(0, 0);
- return dic;
- }
-
-
-
-
-
- public static int GetLhDsCount(List<int> _kjh)
- {
- int c = 0;
- List<int> kjh = new List<int>(_kjh);
- if (kjh.Count > 0)
- {
- kjh.Sort();
- for (int i = 0; i < kjh.Count; i++)
- {
- if (i > 0 && (kjh[i] - kjh[i - 1]) == 1)
- c++;
- }
- }
- return c;
- }
-
-
-
-
-
- public static int GetSsqRedLhCount(string[] os)
- {
- List<int> kjh = new List<int>();
- if (os != null && os.Length > 0)
- {
- for (int i = 0; i < os.Length; i++)
- {
- kjh.Add(TypeConverter.StrToInt(os[i], 0));
- }
- }
- return GetLhDsCount(kjh);
- }
- #endregion
-
-
-
-
-
- public static int GetSsqRedHz(string[] kjh)
- {
- int hz = 0;
- if (kjh != null && kjh.Length > 0)
- {
- for (int i = 0; i < kjh.Length; i++)
- {
- hz = hz + TypeConverter.StrToInt(kjh[i], 0);
- }
- }
- return hz;
- }
-
-
-
-
-
-
- public static bool GetSsqBlueSq(int qj, int val)
- {
- bool flag = false;
- List<int> b1 = new List<int> { 1, 2, 3, 4 };
- List<int> b2 = new List<int> { 5, 6, 7, 8 };
- List<int> b3 = new List<int> { 9, 10, 11, 12 };
- List<int> b4 = new List<int> { 13, 14, 15, 16 };
- if (qj == 1)
- return b1.Contains(val);
- if (qj == 2)
- return b2.Contains(val);
- if (qj == 3)
- return b3.Contains(val);
- if (qj == 4)
- return b4.Contains(val);
- return flag;
- }
-
-
-
-
-
-
-
- public static TimeSpan KjTimeDiff(DateTime nowtime, DateTime kjtime)
- {
- TimeSpan ts = new TimeSpan();
- if (kjtime > nowtime)
- {
- TimeSpan ts1 = new TimeSpan(nowtime.Ticks);
- TimeSpan ts2 = new TimeSpan(kjtime.Ticks);
- ts = ts1.Subtract(ts2).Duration();
- }
- else
- {
- TimeSpan ts1 = new TimeSpan(nowtime.Ticks);
- TimeSpan ts2 = new TimeSpan(nowtime.Ticks);
- ts = ts1.Subtract(ts2).Duration();
- }
- return ts;
- }
-
-
-
-
-
- public static string GetWday(DateTime date)
- {
- DateTime dt = date;
- string wday = "";
- switch (dt.DayOfWeek)
- {
- case DayOfWeek.Monday:
- wday = "星期一"; break;
- case DayOfWeek.Tuesday:
- wday = "星期二"; break;
- case DayOfWeek.Wednesday:
- wday = "星期三"; break;
- case DayOfWeek.Thursday:
- wday = "星期四"; break;
- case DayOfWeek.Friday:
- wday = "星期五"; break;
- case DayOfWeek.Saturday:
- wday = "星期六"; break;
- case DayOfWeek.Sunday:
- wday = "星期日"; break;
- }
- return wday;
- }
-
-
-
-
-
- public static int GetSsqRedWsCount(string[] os)
- {
- List<int> kjh = new List<int>();
- if (os != null && os.Length > 0)
- {
- for (int i = 0; i < os.Length; i++)
- {
- kjh.Add(TypeConverter.StrToInt(os[i], 0));
- }
- }
- List<int> wss = new List<int>();
- for (int i = 0; i < kjh.Count; i++)
- {
- int ws = GetHw(kjh[i]);
- if (!wss.Contains(ws))
- wss.Add(ws);
- }
- return wss.Count;
- }
-
-
-
-
-
-
- public static bool GetNumMix(List<int> list1, List<int> list2)
- {
- return list1.Intersect(list2).ToList().Count > 0 ? true : false;
- }
- #region 大乐透相关方法
-
-
-
-
-
-
- public static string GetDltHqDxxt(int n6, int n7)
- {
- string n6dx = "小";
- string n7dx = "小";
- if (n6 > 6)
- n6dx = "大";
- if (n7 > 6)
- n7dx = "大";
- return (n6dx + n7dx).ToString().Trim();
- }
- #endregion
-
-
-
-
-
- public static int GetZ3Num(int kjh)
- {
- string result = string.Empty;
- List<int> k = GetNumList(kjh);
- int n = 0;
- if (k[0] == k[1])
- return k[0];
- if (k[1] == k[2])
- return k[1];
- if (k[0] == k[2])
- return k[0];
- return n;
- }
-
-
-
-
-
-
-
-
- public static string GetZ3Xt(int kjh)
- {
- string result = string.Empty;
- List<int> k = GetNumList(kjh);
- if (k != null)
- {
- if (k[0] == k[1])
- result = "AAB";
- if (k[1] == k[2])
- result = "BAA";
- if (k[0] == k[2])
- result = "ABA";
- }
- return result;
- }
-
-
-
-
-
-
-
- public static int GetZxth(int sjh, int kjh)
- {
- int result = 0;
- List<int> s = GetNumList(sjh);
- List<int> k = GetNumList(kjh);
- for (int i = 0; i < s.Count; i++)
- {
- if (k.Contains(s[i]))
- result++;
- }
- return result;
- }
-
-
-
-
-
-
-
- public static int GetZxth(List<int> sjh, List<int> kjh)
- {
- int result = 0;
- for (int i = 0; i < sjh.Count; i++)
- {
- if (kjh.Contains(sjh[i]))
- result++;
- }
- return result;
- }
-
-
-
-
-
-
-
- public static List<bool> GetZxtw(int sjh, int kjh)
- {
- List<bool> list = new List<bool> { false, false, false };
- List<int> s = GetNumList(sjh);
- List<int> k = GetNumList(kjh);
- for (int i = 0; i < s.Count; i++)
- {
- if (k[i] == s[i])
- list[i] = true;
- }
- return list;
- }
-
-
-
-
-
-
-
- public static List<bool> GetZxtw(List<int> sjh, List<int> kjh)
- {
- List<bool> list = new List<bool> { false, false, false };
- for (int i = 0; i < sjh.Count; i++)
- {
- if (kjh[i] == sjh[i])
- list[i] = true;
- }
- return list;
- }
-
-
-
-
-
-
- public static List<int> GetNumList(int num)
- {
-
- List<int> nums = new List<int>();
- if (num < 0)
- {
- nums.Add(-1);
- nums.Add(-1);
- nums.Add(-1);
- return nums;
- }
- int b = num / 100;
- int s = (num - b * 100) / 10;
- int g = num - (b * 100 + s * 10);
- nums.Add(b);
- nums.Add(s);
- nums.Add(g);
- return nums;
- }
-
-
-
-
-
-
- public static int GetHd15x5_4lh(List<int> _kjh)
- {
- int c = 0;
- List<int> kjh = new List<int>(_kjh);
- if (kjh != null && kjh.Count > 0)
- {
- kjh.Sort();
- for (int i = 0; i < kjh.Count; i++)
- {
- if (i > 0 && (kjh[i] - kjh[i - 1]) == 1 && Math.Abs(kjh[i - 1] - kjh[i]) == 1)
- c++;
- else if (c < 3)
- c = 0;
- }
- }
- if (c >= 3)
- return 1;
- return 0;
- }
-
-
-
-
-
-
- public static int GetIs3lh(List<int> _kjh)
- {
- int c = 0;
- List<int> kjh = new List<int>(_kjh);
- if (kjh != null && kjh.Count > 0)
- {
- kjh.Sort();
- for (int i = 0; i < kjh.Count; i++)
- {
- if (i > 0 && (kjh[i] - kjh[i - 1]) == 1 && Math.Abs(kjh[i - 1] - kjh[i]) == 1)
- c++;
- else if (c < 3)
- c = 0;
- }
- }
- if (c >= 2)
- return 1;
- return 0;
- }
-
-
-
-
-
-
- public static string GetLh(int num)
- {
- string result = "否";
- List<int> kds = GetKdList(num);
- if (kds != null && kds.Count > 0)
- {
- for (int i = 0; i < kds.Count; i++)
- {
- if (kds[i] == 1 || kds[i] == 9)
- {
- result = "是";
- return result;
- }
- }
- }
- return result;
- }
-
-
-
-
-
-
- public static string GetSZ(int num)
- {
- string result = "否";
- List<int> kds = GetKdList(num);
- if (kds != null && kds.Count > 0)
- {
- if (kds[0] == 2 && kds[1] == 1 && kds[2] == 1)
- {
- result = "顺";
- return result;
- }
- for (int i = 0; i < kds.Count; i++)
- {
- if (kds[i] == 1)
- {
- result = "半";
- return result;
- }
- }
- }
- return result;
- }
-
-
-
-
-
-
- public static string GetCh(int num1, int num2)
- {
- string result = "否";
- List<int> kjh1 = GetNumList(num1);
- List<int> kjh2 = GetNumList(num2);
- if (kjh1.Intersect(kjh2).ToList().Count > 0)
- result = "是";
- return result;
- }
-
-
-
-
-
-
- public static List<string> Get2m(List<int> _kjh)
- {
- List<string> list = new List<string>();
- List<int> kjh = new List<int>(_kjh);
- kjh.Sort();
- list.Add(kjh[0].ToString() + kjh[1].ToString());
- list.Add(kjh[0].ToString() + kjh[2].ToString());
- list.Add(kjh[1].ToString() + kjh[2].ToString());
- return list;
- }
-
-
-
-
-
-
-
-
-
-
- public static string GetQd(int kjh)
- {
- string result = string.Empty;
- if (kjh >= 0 && kjh < 250)
- result = "A";
- if (kjh >= 250 && kjh < 500)
- result = "B";
- if (kjh >= 500 && kjh < 750)
- result = "C";
- if (kjh >= 750 && kjh < 1000)
- result = "D";
- return result;
- }
-
-
-
-
-
-
- public static string GetSjxzh(List<int> nums)
- {
- string result = string.Empty;
- if (nums[0] == nums[1] && nums[1] == nums[2])
- {
- result = "平";
- return result;
- }
- if (nums[0] > nums[1] && nums[1] > nums[2])
- {
- result = "降";
- return result;
- }
- if (nums[0] < nums[1] && nums[1] < nums[2])
- {
- result = "升";
- return result;
- }
- if (nums[0] > nums[1] && nums[1] < nums[2])
- {
- result = "凹";
- return result;
- }
- if (nums[0] < nums[1] && nums[1] > nums[2])
- {
- result = "凸";
- return result;
- }
- if (nums[0] == nums[1] || nums[1] == nums[2] || nums[0] == nums[2])
- {
- result = "偏";
- return result;
- }
- return result;
- }
-
-
-
-
-
-
-
-
-
- public static List<int> GetKdCount(int kd, List<int> data)
- {
- List<int> list = new List<int>();
- List<int> temp = new List<int>();
- list.Add(0);
- list.Add(0);
- list.Add(0);
- list.Add(0);
- for (int i = 0; i < data.Count; i++)
- {
- if (GetKd(data[i]) == kd)
- temp.Add(data[i]);
- }
- list[0] = temp.Count;
- for (int i = 0; i < temp.Count; i++)
- {
- if (GetZxxt(temp[i]) == 3)
- list[1]++;
- if (GetZxxt(temp[i]) == 6)
- list[2]++;
- if (GetZxxt(temp[i]) == 0)
- list[3]++;
- }
- return list;
- }
-
-
-
-
-
-
-
-
-
- public static List<int> GetHzCount(int hz, List<int> data)
- {
- List<int> list = new List<int>();
- List<int> temp = new List<int>();
- list.Add(0);
- list.Add(0);
- list.Add(0);
- list.Add(0);
- for (int i = 0; i < data.Count; i++)
- {
- if (GetHz(data[i]) == hz)
- temp.Add(data[i]);
- }
- list[0] = temp.Count;
- for (int i = 0; i < temp.Count; i++)
- {
- if (GetZxxt(temp[i]) == 3)
- list[1]++;
- if (GetZxxt(temp[i]) == 6)
- list[2]++;
- if (GetZxxt(temp[i]) == 0)
- list[3]++;
- }
- return list;
- }
-
-
-
-
-
- public static int GetZxxt(int num)
- {
- List<int> temp = GetNumList(num);
- return GetZxxt(temp);
- }
-
-
-
-
-
- public static int GetZxxt(List<int> l)
- {
- int xt = 0;
- List<int> temp = new List<int>(l);
- if (temp[0] == temp[1] && temp[1] == temp[2] && temp[0] == temp[2])
- {
- xt = 0;
- return xt;
- }
- if (temp[0] == temp[1] || temp[1] == temp[2] || temp[0] == temp[2])
- {
- xt = 3;
- return xt;
- }
- if (temp[0] != temp[1] && temp[1] != temp[2] && temp[0] != temp[2])
- {
- xt = 6;
- return xt;
- }
- return xt;
- }
- public static int GetKd(List<int> kjh)
- {
- List<int> _kjh = new List<int>(kjh);
- _kjh.Sort();
- return Math.Abs(_kjh[0] - _kjh[_kjh.Count - 1]);
- }
-
-
-
-
-
- public static int GetKd(int num)
- {
- List<int> kjh = GetNumList(num);
- kjh.Sort();
- return Math.Abs(kjh[0] - kjh[kjh.Count - 1]);
- }
-
-
-
-
-
- public static List<int> GetP5KdList(List<int> _kjh)
- {
- List<int> kjh = new List<int>(_kjh);
- kjh.Sort();
- List<int> kds = new List<int>();
- for (int i = 0; i < kjh.Count; i++)
- {
- if (i > 0)
- kds.Add(Math.Abs(kjh[i] - kjh[i - 1]));
- }
- return kds;
- }
-
-
-
-
-
- public static List<int> GetKdList(List<int> _kjh)
- {
- List<int> kds = new List<int>();
- List<int> kjh = new List<int>(_kjh);
- kjh.Sort();
- kds.Add(Math.Abs(kjh[0] - kjh[kjh.Count - 1]));
- kds.Add(Math.Abs(kjh[0] - kjh[1]));
- kds.Add(Math.Abs(kjh[1] - kjh[kjh.Count - 1]));
- return kds;
- }
-
-
-
-
-
- public static List<int> GetKdList(int num)
- {
- List<int> kjh = GetNumList(num);
- List<int> kds = new List<int>();
- kjh.Sort();
- kds.Add(Math.Abs(kjh[0] - kjh[kjh.Count - 1]));
- kds.Add(Math.Abs(kjh[0] - kjh[1]));
- kds.Add(Math.Abs(kjh[1] - kjh[kjh.Count - 1]));
- return kds;
- }
-
-
-
-
-
- public static List<int> GetBSGKdList(int num)
- {
- List<int> kjh = GetNumList(num);
- List<int> kds = new List<int>();
- kds.Add(Math.Abs(kjh[0] - kjh[1]));
- kds.Add(Math.Abs(kjh[1] - kjh[2]));
- kds.Add(Math.Abs(kjh[0] - kjh[2]));
- return kds;
- }
-
-
-
-
-
- public static int GetHz(int kjh)
- {
- List<int> k = GetNumList(kjh);
- k.Sort();
- return k[0] + k[1] + k[2];
- }
-
-
-
-
-
- public static int GetHz(List<int> k)
- {
- return k[0] + k[1] + k[2];
- }
-
-
-
-
-
-
- public static int Get012Gs(List<int> list, int ls)
- {
- int n = 0;
- for (int i = 0; i < list.Count; i++)
- {
- if (Get012(list[i]) == ls)
- n++;
- }
- return n;
- }
- #region P5一些方法
-
-
-
-
-
- public static List<int> GetP5NumList(string num)
- {
- List<int> list = new List<int>();
- if (num.Trim().Length != 5)
- return list;
- for (int i = 0; i < num.Length; i++)
- {
- list.Add(TypeConverter.StrToInt(num.Substring(i, 1), 0));
- }
- return list;
- }
-
-
-
-
-
- public static int GetP5Hz(string num)
- {
- List<int> list = GetP5NumList(num);
- int hz = 0;
- if (list != null && list.Count > 0)
- {
- for (int i = 0; i < list.Count; i++)
- {
- hz = hz + list[i];
- }
- }
- return hz;
- }
-
-
-
-
-
- public static int GetP5LhCount(string num)
- {
- List<int> list = GetP5NumList(num);
- int c = 0;
- if (list != null && list.Count > 0)
- {
- for (int i = 0; i < list.Count; i++)
- {
- if (i > 0 && (list[i] - list[i - 1]) == 1)
- c++;
- }
- }
- return c;
- }
- #endregion
- #region P7的一些方法
-
-
-
-
-
- public static List<int> GetP7NumList(string num)
- {
- List<int> list = new List<int>();
- if (num.Trim().Length != 7)
- return list;
- for (int i = 0; i < num.Length; i++)
- {
- list.Add(TypeConverter.StrToInt(num.Substring(i, 1), 0));
- }
- return list;
- }
-
-
-
-
-
- public static int GetP7Hz(string num)
- {
- List<int> list = GetP7NumList(num);
- int hz = 0;
- if (list != null && list.Count > 0)
- {
- for (int i = 0; i < list.Count; i++)
- {
- hz = hz + list[i];
- }
- }
- return hz;
- }
-
-
-
-
-
- public static int GetP7LhCount(string num)
- {
- List<int> list = GetP7NumList(num);
- int c = 0;
- if (list != null && list.Count > 0)
- {
- for (int i = 0; i < list.Count; i++)
- {
- if (i > 0 && (list[i] - list[i - 1]) == 1)
- c++;
- }
- }
- return c;
- }
-
-
-
-
-
- public static int GetP7ThCount(string num)
- {
- List<int> list = GetP7NumList(num);
- List<int> th = new List<int>();
- List<int> temp = new List<int>();
- foreach (int i in list)
- {
- if (!th.Contains(i))
- {
- th.Add(i);
- }
- else
- {
- temp.Add(i);
- }
- }
- list.RemoveAll(o =>
- {
- if (temp.Contains(o))
- return true;
- else
- return false;
- });
- return 7 - list.Count();
- }
- #endregion
- #region 东方61的一些方法
-
-
-
-
-
- public static List<int> GetDf61NumList(string num)
- {
- List<int> list = new List<int>();
- if (num.Trim().Length != 6)
- return list;
- for (int i = 0; i < num.Length; i++)
- {
- list.Add(TypeConverter.StrToInt(num.Substring(i, 1), 0));
- }
- return list;
- }
-
-
-
-
-
- public static int GetDf61Hz(string num)
- {
- List<int> list = GetDf61NumList(num);
- int hz = 0;
- if (list != null && list.Count > 0)
- {
- for (int i = 0; i < list.Count; i++)
- {
- hz = hz + list[i];
- }
- }
- return hz;
- }
-
-
-
-
-
- public static int GetDf61LhCount(string num)
- {
- List<int> list = GetDf61NumList(num);
- int c = 0;
- if (list != null && list.Count > 0)
- {
- for (int i = 0; i < list.Count; i++)
- {
- if (i > 0 && (list[i] - list[i - 1]) == 1)
- c++;
- }
- }
- return c;
- }
-
-
-
-
-
- public static int GetDf61ThCount(string num)
- {
- List<int> list = GetDf61NumList(num);
- List<int> th = new List<int>();
- List<int> temp = new List<int>();
- foreach (int i in list)
- {
- if (!th.Contains(i))
- {
- th.Add(i);
- }
- else
- {
- temp.Add(i);
- }
- }
- list.RemoveAll(o =>
- {
- if (temp.Contains(o))
- return true;
- else
- return false;
- });
- return 6 - list.Count();
- }
- #endregion
- #region 浙江6+1
-
-
-
-
-
- public static List<int> GetZj61NumList(string num)
- {
- List<int> list = new List<int>();
- if (num.Trim().Length != 7)
- return list;
- for (int i = 0; i < num.Length; i++)
- {
- list.Add(TypeConverter.StrToInt(num.Substring(i, 1), 0));
- }
- return list;
- }
-
-
-
-
-
- public static int GetZj61Hz(string num)
- {
- List<int> list = GetZj61NumList(num);
- int hz = 0;
- if (list != null && list.Count > 0)
- {
- for (int i = 0; i < list.Count; i++)
- {
- hz = hz + list[i];
- }
- }
- return hz;
- }
-
-
-
-
-
- public static int GetZj61LhCount(string num)
- {
- List<int> list = GetZj61NumList(num);
- int c = 0;
- if (list != null && list.Count > 0)
- {
- for (int i = 0; i < list.Count; i++)
- {
- if (i > 0 && (list[i] - list[i - 1]) == 1)
- c++;
- }
- }
- return c;
- }
-
-
-
-
-
- public static int GetZj61ThCount(string num)
- {
- List<int> list = GetZj61NumList(num);
- List<int> th = new List<int>();
- int[] temp = new int[10];
- for (int i = 0; i < temp.Length; i++)
- temp[i] = 0;
- foreach (int i in list)
- {
- temp[i]++;
- }
- List<int> max = new List<int>();
- for (int i = 0; i < temp.Length; i++)
- {
- max.Add(temp[i]);
- }
- return max.Max();
- }
- #endregion
-
-
-
-
-
- public static int GetHw(int hz)
- {
- int hw = 0;
- string s = hz.ToString();
- if (s.Length == 4)
- return TypeConverter.StrToInt(s.Substring(3, 1));
- if (s.Length == 3)
- return TypeConverter.StrToInt(s.Substring(2, 1));
- if (s.Length == 2)
- return TypeConverter.StrToInt(s.Substring(1, 1));
- if (s.Length == 1)
- return hz;
- return hw;
- }
-
-
-
-
-
- public static int GetWshz(List<int> kjh)
- {
- int wshz = 0;
- if (kjh != null && kjh.Count > 0)
- {
- for (int i = 0; i < kjh.Count; i++)
- {
- wshz = wshz + GetHw(kjh[i]);
- }
- }
- return wshz;
- }
-
-
-
-
-
- public static int GetMaxJs(List<int> kjh)
- {
- List<int> temp = new List<int>();
- foreach (int i in kjh)
- {
- if (i % 2 != 0)
- temp.Add(i);
- }
- if (temp.Count > 0)
- return temp.Max();
- else
- return -1;
- }
-
-
-
-
-
- public static int GetMinJs(List<int> kjh)
- {
- List<int> temp = new List<int>();
- foreach (int i in kjh)
- {
- if (i % 2 != 0)
- temp.Add(i);
- }
- if (temp.Count > 0)
- return temp.Min();
- else
- return -1;
- }
-
-
-
-
-
- public static int GetMaxOs(List<int> kjh)
- {
- List<int> temp = new List<int>();
- foreach (int i in kjh)
- {
- if (i % 2 == 0)
- temp.Add(i);
- }
- if (temp.Count > 0)
- return temp.Max();
- else
- return -1;
- }
-
-
-
-
-
- public static int GetMinOs(List<int> kjh)
- {
- List<int> temp = new List<int>();
- foreach (int i in kjh)
- {
- if (i % 2 == 0)
- temp.Add(i);
- }
- if (temp.Count > 0)
- return temp.Min();
- else
- return -1;
- }
-
-
-
-
-
- public static int GetMaxZs(List<int> kjh)
- {
- List<int> temp = new List<int>();
- List<int> data = new List<int> { 0, 4, 6, 8, 9 };
- foreach (int i in kjh)
- {
- if (!data.Contains(i))
- temp.Add(i);
- }
- if (temp.Count > 0)
- return temp.Max();
- else
- return -1;
- }
-
-
-
-
-
- public static int GetMinZs(List<int> kjh)
- {
- List<int> temp = new List<int>();
- List<int> data = new List<int> { 0, 4, 6, 8, 9 };
- foreach (int i in kjh)
- {
- if (!data.Contains(i))
- temp.Add(i);
- }
- if (temp.Count > 0)
- return temp.Min();
- else
- return -1;
- }
-
-
-
-
-
- public static int GetMaxHs(List<int> kjh)
- {
- List<int> temp = new List<int>();
- List<int> data = new List<int> { 0, 4, 6, 8, 9 };
- foreach (int i in kjh)
- {
- if (data.Contains(i))
- temp.Add(i);
- }
- if (temp.Count > 0)
- return temp.Max();
- else
- return -1;
- }
-
-
-
-
-
- public static int GetMinHs(List<int> kjh)
- {
- List<int> temp = new List<int>();
- List<int> data = new List<int> { 0, 4, 6, 8, 9 };
- foreach (int i in kjh)
- {
- if (data.Contains(i))
- temp.Add(i);
- }
- if (temp.Count > 0)
- return temp.Min();
- else
- return -1;
- }
-
-
-
-
-
- public static List<int> ConvertList(List<string> kjh)
- {
- List<int> list = new List<int>();
- if (kjh == null || kjh.Count == 0)
- return list;
- foreach (string s in kjh)
- {
- list.Add(TypeConverter.ObjectToInt(s, -1));
- }
- return list;
- }
- #region 广东好彩1相关
-
-
-
-
-
- public static string GetJiJie(int n)
- {
- string result = string.Empty;
- if (n > 0 && n < 10)
- result = "春";
- if (n > 9 && n < 19)
- result = "夏";
- if (n > 18 && n < 28)
- result = "秋";
- if (n > 27)
- result = "冬";
- return result;
- }
-
-
-
-
-
- public static string GetFangWei(int n)
- {
- string result = string.Empty;
- List<int> fd = new List<int> { 1, 3, 5, 7, 9, 11, 13, 15, 17 };
- List<int> fn = new List<int> { 2, 4, 6, 8, 10, 12, 14, 16, 18 };
- List<int> fx = new List<int> { 19, 21, 23, 25, 27, 29, 31, 33, 35 };
- List<int> fb = new List<int> { 20, 22, 24, 26, 28, 30, 32, 34, 36 };
- if (fd.Contains(n))
- result = "东";
- if (fn.Contains(n))
- result = "南";
- if (fx.Contains(n))
- result = "西";
- if (fb.Contains(n))
- result = "北";
- return result;
- }
-
-
-
-
- public static string GetShengXiao(int n)
- {
- string result = string.Empty;
- List<int> s1 = new List<int> { 1, 13, 25 };
- List<int> s2 = new List<int> { 2, 14, 26 };
- List<int> s3 = new List<int> { 3, 15, 27 };
- List<int> s4 = new List<int> { 4, 16, 28 };
- List<int> s5 = new List<int> { 5, 17, 29 };
- List<int> s6 = new List<int> { 6, 18, 30 };
- List<int> s7 = new List<int> { 7, 19, 31 };
- List<int> s8 = new List<int> { 8, 20, 32 };
- List<int> s9 = new List<int> { 9, 21, 33 };
- List<int> s10 = new List<int> { 10, 22, 34 };
- List<int> s11 = new List<int> { 11, 23, 35 };
- List<int> s12 = new List<int> { 12, 24, 36 };
- if (s1.Contains(n))
- return "鼠";
- if (s2.Contains(n))
- return "牛";
- if (s3.Contains(n))
- return "虎";
- if (s4.Contains(n))
- return "兔";
- if (s5.Contains(n))
- return "龙";
- if (s6.Contains(n))
- return "蛇";
- if (s7.Contains(n))
- return "马";
- if (s8.Contains(n))
- return "羊";
- if (s9.Contains(n))
- return "猴";
- if (s10.Contains(n))
- return "鸡";
- if (s11.Contains(n))
- return "狗";
- if (s12.Contains(n))
- return "猪";
- return result;
- }
- #endregion
- #region 香港彩相关
- static int[] Bs_red = { 1, 2, 7, 8, 12, 13, 18, 19, 23, 24, 29, 30, 34, 35, 40, 45, 46 };
- static int[] Bs_blue = { 3, 4, 9, 10, 14, 15, 20, 25, 26, 31, 36, 37, 41, 42, 47, 48 };
- static int[] Bs_green = { 5, 6, 11, 16, 17, 21, 22, 27, 28, 32, 33, 38, 39, 43, 44, 49 };
-
-
-
-
-
- public static int GetNumBoSe(int n)
- {
- if (Bs_red.Contains(n))
- {
- return 0;
- }
- else if (Bs_blue.Contains(n))
- {
- return 1;
- }
- else
- {
- return 2;
- }
- }
-
-
-
-
-
- public static int GetNumBBoSe(int n)
- {
- if (Bs_red.Contains(n) && n % 2 == 1)
- {
- return 0;
- }
- else if (Bs_red.Contains(n) && n % 2 == 0)
- {
- return 3;
- }
- else if (Bs_blue.Contains(n) && n % 2 == 1)
- {
- return 1;
- }
- else if (Bs_blue.Contains(n) && n % 2 == 0)
- {
- return 4;
- }
- else if (Bs_green.Contains(n) && n % 2 == 1)
- {
- return 2;
- }
- else
- {
- return 5;
- }
- }
-
-
-
-
-
- public static int GetNumTmds(int n)
- {
- if (n % 2 == 1)
- {
- return 0;
- }
- else
- {
- return 1;
- }
- }
-
-
-
-
-
- public static int GetNumTtds(int n)
- {
- if (n / 10 == 0 || n / 10 % 2 == 0)
- {
- return 1;
- }
- else
- {
- return 0;
- }
- }
-
-
-
-
-
- public static int GetNumtmttds(int n)
- {
- if (n / 10 == 0 || n / 10 % 2 == 0)
- {
- return 0;
- }
- else
- {
- return 1;
- }
- }
-
-
-
-
-
- public static int GetNumtmtwdx(int n)
- {
- if (n % 10 < 5)
- {
- return 0;
- }
- else
- {
- return 1;
- }
- }
-
-
-
-
-
- public static int GetNumHsds(int n)
- {
- if (n / 10 == 0 || n / 10 % 2 == 0)
- {
- return 1;
- }
- else
- {
- return 0;
- }
- }
- #endregion
- }
- }
|