{"id":6140,"date":"2024-08-18T15:01:01","date_gmt":"2024-08-18T07:01:01","guid":{"rendered":""},"modified":"2024-08-18T15:01:01","modified_gmt":"2024-08-18T07:01:01","slug":"\u534e\u4e3a\u673a\u8bd5\u6709\u51e0\u9053\u9898_\u534e\u4e3a\u4e3b\u9898","status":"publish","type":"post","link":"https:\/\/mushiming.com\/6140.html","title":{"rendered":"\u534e\u4e3a\u673a\u8bd5\u6709\u51e0\u9053\u9898_\u534e\u4e3a\u4e3b\u9898"},"content":{"rendered":"

\n <\/path> \n<\/svg> <\/p>\n

\u9898\u76ee\u6765\u6e90\uff1a\u725b\u5ba2\u7f51<\/p>\n

\u9898\u5341\u4e00. HJ66 \u914d\u7f6e\u6587\u4ef6\u6062\u590d<\/h3>\n

\"\u534e\u4e3a\u673a\u8bd5\u6709\u51e0\u9053\u9898_\u534e\u4e3a\u4e3b\u9898
\"\u534e\u4e3a\u673a\u8bd5\u6709\u51e0\u9053\u9898_\u534e\u4e3a\u4e3b\u9898<\/p>\n

#include<\/span> <iostream><\/span><\/span> #include<\/span> <string><\/span><\/span> #include<\/span> <sstream><\/span><\/span> using<\/span> namespace<\/span> std;<\/span> bool<\/span> match<\/span>(<\/span>string str,<\/span> string s)<\/span> { \n   <\/span> return<\/span> str.<\/span>find<\/span>(<\/span>s)<\/span> ==<\/span> 0<\/span>;<\/span> }<\/span> int<\/span> main<\/span>(<\/span>)<\/span> { \n   <\/span> string str;<\/span> string cmd[<\/span>6<\/span>]<\/span> =<\/span> { \n   <\/span>\"reset\"<\/span>,<\/span> \"reset board\"<\/span>,<\/span> \"board add\"<\/span>,<\/span> \"board delete\"<\/span>,<\/span> \"reboot backplane\"<\/span>,<\/span> \"backplane abort\"<\/span> }<\/span>;<\/span> string res[<\/span>7<\/span>]<\/span> =<\/span> { \n   <\/span>\"reset what\"<\/span>,<\/span> \"board fault\"<\/span>,<\/span> \"where to add\"<\/span>,<\/span> \"no board at all\"<\/span>,<\/span> \"impossible\"<\/span>,<\/span> \"install first\"<\/span>,<\/span> \"unknown command\"<\/span> }<\/span>;<\/span> while<\/span> (<\/span>getline<\/span>(<\/span>cin,<\/span> str)<\/span>)<\/span> { \n   <\/span> string s1,<\/span> s2,<\/span> temp;<\/span> stringstream ss<\/span>(<\/span>str)<\/span>;<\/span> ss >><\/span> s1 >><\/span> s2;<\/span> int<\/span> resi =<\/span> 6<\/span>;<\/span> if<\/span> (<\/span>s2.<\/span>empty<\/span>(<\/span>)<\/span>)<\/span> resi =<\/span> match<\/span>(<\/span>cmd[<\/span>0<\/span>]<\/span>,<\/span> s1)<\/span> ?<\/span> 0<\/span> :<\/span> 6<\/span>;<\/span> else<\/span> { \n   <\/span> bool<\/span> flag =<\/span> false<\/span>;<\/span> for<\/span> (<\/span>int<\/span> i =<\/span> 1<\/span>;<\/span> i <<\/span> 6<\/span>;<\/span> i++<\/span>)<\/span> { \n   <\/span> stringstream allcmd<\/span>(<\/span>cmd[<\/span>i]<\/span>)<\/span>;<\/span> allcmd >><\/span> temp >><\/span> temp;<\/span> if<\/span> (<\/span>match<\/span>(<\/span>cmd[<\/span>i]<\/span>,<\/span> s1)<\/span> &&<\/span> match<\/span>(<\/span>temp,<\/span> s2)<\/span>)<\/span> { \n   <\/span> if<\/span> (<\/span>!<\/span>flag)<\/span> { \n   <\/span> flag =<\/span> true<\/span>;<\/span> resi =<\/span> i;<\/span> }<\/span> else<\/span> { \n   <\/span> resi =<\/span> 6<\/span>;<\/span> break<\/span>;<\/span> }<\/span> }<\/span> }<\/span> }<\/span> cout <<<\/span> res[<\/span>resi]<\/span> <<<\/span> endl;<\/span> }<\/span> return<\/span> 0<\/span>;<\/span> }<\/span> <\/code><\/pre>\n

\u9898\u5341\u4e8c. HJ72 \u767e\u94b1\u4e70\u767e\u9e21\u95ee\u9898<\/h3>\n
\n

\u9898\u76ee\u63cf\u8ff0
\u516c\u5143\u524d\u4e94\u4e16\u7eaa\uff0c\u6211\u56fd\u53e4\u4ee3\u6570\u5b66\u5bb6\u5f20\u4e18\u5efa\u5728\u300a\u7b97\u7ecf\u300b\u4e00\u4e66\u4e2d\u63d0\u51fa\u4e86\u201c\u767e\u9e21\u95ee\u9898\u201d\uff1a\u9e21\u7fc1\u4e00\u503c\u94b1\u4e94\uff0c\u9e21\u6bcd\u4e00\u503c\u94b1\u4e09\uff0c\u9e21\u96cf\u4e09\u503c\u94b1\u4e00\u3002\u767e\u94b1\u4e70\u767e\u9e21\uff0c\u95ee\u9e21\u7fc1\u3001\u9e21\u6bcd\u3001\u9e21\u96cf\u5404\u51e0\u4f55\uff1f<\/p>\n

\u8be6\u7ec6\u63cf\u8ff0\uff1a<\/p>\n

\u63a5\u53e3\u8bf4\u660e<\/p>\n

\u539f\u578b\uff1a<\/p>\n

int GetResult(vector &list)<\/p>\n

\u8f93\u5165\u53c2\u6570\uff1a<\/p>\n

 \u65e0 <\/code><\/pre>\n

\u8f93\u51fa\u53c2\u6570\uff08\u6307\u9488\u6307\u5411\u7684\u5185\u5b58\u533a\u57df\u4fdd\u8bc1\u6709\u6548\uff09\uff1a<\/p>\n

list \u9e21\u7fc1\u3001\u9e21\u6bcd\u3001\u9e21\u96cf\u7ec4\u5408\u7684\u5217\u8868 <\/code><\/pre>\n

\u8fd4\u56de\u503c\uff1a<\/p>\n

 -1 \u5931\u8d25 0 \u6210\u529f <\/code><\/pre>\n<\/blockquote>\n
\n

\u8f93\u5165\u63cf\u8ff0: \u8f93\u5165\u4efb\u4f55\u4e00\u4e2a\u6574\u6570\uff0c\u5373\u53ef\u8fd0\u884c\u7a0b\u5e8f\u3002<\/p>\n

\u8f93\u51fa\u63cf\u8ff0:<\/p>\n<\/blockquote>\n

\"\u534e\u4e3a\u673a\u8bd5\u6709\u51e0\u9053\u9898_\u534e\u4e3a\u4e3b\u9898<\/p>\n

#include<\/span><iostream><\/span><\/span> #include<\/span><vector><\/span><\/span> using<\/span> namespace<\/span> std;<\/span> int<\/span> main<\/span>(<\/span>)<\/span> { \n   <\/span> int<\/span> n;<\/span> while<\/span>(<\/span>cin >><\/span> n)<\/span>{ \n   <\/span> for<\/span>(<\/span>int<\/span> x =<\/span> 0<\/span>;<\/span> x <=<\/span> 100<\/span>\/<\/span>5<\/span>;<\/span> x++<\/span>)<\/span> { \n   <\/span> double<\/span> y =<\/span> (<\/span>200<\/span> -<\/span>14<\/span>*<\/span>x)<\/span>\/<\/span>8.0<\/span>;<\/span> double<\/span> z =<\/span> 100<\/span> -<\/span> y -<\/span> x;<\/span> if<\/span>(<\/span>y ==<\/span> int<\/span>(<\/span>y)<\/span> &&<\/span> y >=<\/span> 0<\/span> &&<\/span> z >=<\/span> 0<\/span>)<\/span> cout <<<\/span> x <<<\/span> \" \"<\/span> <<<\/span> y <<<\/span> \" \"<\/span><<<\/span> z <<<\/span> endl;<\/span> }<\/span> }<\/span> return<\/span> 0<\/span>;<\/span> }<\/span> <\/code><\/pre>\n

\u9898\u5341\u4e09. HJ73 \u8ba1\u7b97\u65e5\u671f\u5230\u5929\u6570\u8f6c\u6362<\/h3>\n
\n

\u9898\u76ee\u63cf\u8ff0 \u6839\u636e\u8f93\u5165\u7684\u65e5\u671f\uff0c\u8ba1\u7b97\u662f\u8fd9\u4e00\u5e74\u7684\u7b2c\u51e0\u5929\u3002<\/p>\n

\u8f93\u5165\u63cf\u8ff0: \u8f93\u5165\u4e00\u884c\uff0c\u6bcf\u884c\u7a7a\u683c\u5206\u5272\uff0c\u5206\u522b\u662f\u5e74\uff0c\u6708\uff0c\u65e5<\/p>\n

\u8f93\u51fa\u63cf\u8ff0: \u8f93\u51fa\u662f\u8fd9\u4e00\u5e74\u7684\u7b2c\u51e0\u5929<\/p>\n<\/blockquote>\n

\n

\u793a\u4f8b1
\u8f93\u5165
2012 12 31
\u8f93\u51fa
366<\/p>\n<\/blockquote>\n

#include<\/span><iostream><\/span><\/span> using<\/span> namespace<\/span> std;<\/span> int<\/span> runMon[<\/span>12<\/span>]<\/span> =<\/span> { \n   <\/span>31<\/span>,<\/span>29<\/span>,<\/span>31<\/span>,<\/span>30<\/span>,<\/span>31<\/span>,<\/span>30<\/span>,<\/span>31<\/span>,<\/span>31<\/span>,<\/span>30<\/span>,<\/span>31<\/span>,<\/span>30<\/span>,<\/span>31<\/span>}<\/span>;<\/span> int<\/span> pingMon[<\/span>12<\/span>]<\/span> =<\/span> { \n   <\/span>31<\/span>,<\/span>28<\/span>,<\/span>31<\/span>,<\/span>30<\/span>,<\/span>31<\/span>,<\/span>30<\/span>,<\/span>31<\/span>,<\/span>31<\/span>,<\/span>30<\/span>,<\/span>31<\/span>,<\/span>30<\/span>,<\/span>31<\/span>}<\/span>;<\/span> int<\/span> dataToDay<\/span>(<\/span>int<\/span> year,<\/span> int<\/span> month,<\/span> int<\/span> day)<\/span> { \n   <\/span> if<\/span>(<\/span>year <=<\/span> 0<\/span>||<\/span> month <=<\/span> 0<\/span>||<\/span> month ><\/span> 12<\/span> ||<\/span> day ><\/span>31<\/span> ||<\/span> day <=<\/span> 0<\/span>)<\/span> return<\/span> -<\/span>1<\/span>;<\/span> int<\/span> res =<\/span> 0<\/span>;<\/span> int<\/span> flag <\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"\u534e\u4e3a\u673a\u8bd5\u6709\u51e0\u9053\u9898_\u534e\u4e3a\u4e3b\u9898\u9898\u76ee\u6765\u6e90\uff1a\u725b\u5ba2\u7f51\u9898\u5341\u4e00.HJ66\u914d\u7f6e\u6587\u4ef6\u6062\u590d#includeiostream#includestring#includesstreamusingnam...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/6140"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=6140"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/6140\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=6140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=6140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=6140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}