{"id":202,"date":"2012-10-20T22:46:00","date_gmt":"2012-10-20T14:46:00","guid":{"rendered":"http:\/\/nike0good.jp1.rpvhost.net\/107"},"modified":"2012-10-20T22:46:00","modified_gmt":"2012-10-20T14:46:00","slug":"number_dp-nature_state","status":"publish","type":"post","link":"https:\/\/nike0good.com\/?p=202","title":{"rendered":"Number (dp-\u6027\u8d28\u6570\u72b6\u6001\u8868\u793a\uff09"},"content":{"rendered":"<p align=\"center\">Number<\/p>\n<p>\u3010\u9898\u76ee\u63cf\u8ff0\u3011<\/p>\n<p>\u660e\u660e\u5728\u505a\u529b\u5b66\u4f5c\u4e1a\u7684\u65f6\u5019\u53d1\u73b0\u4e00\u7c7b\u6570\u975e\u5e38\u6709\u8da3\uff0c\u4ed6\u4eec\u548c\u6760\u6746\u6709\u6bd4\u8f83\u76f8&#20284;\u7684\u7ed3\u6784\u3002\u8fd9\u7c7b\u6570\u6709\u8fd9\u6837\u7684\u6027\u8d28\uff1a<\/p>\n<p>\u628a\u67d0\u4e00\u4f4d\u5f53\u6210\u652f\u70b9\u7684\u8bdd\uff0c\u90a3\u4e48\u5de6\u8fb9\u7684\u6570\u5b57\u5230\u8fd9\u4e2a\u70b9\u7684\u529b\u77e9\u548c\u7b49\u4e8e\u53f3\u8fb9\u7684\u6570\u5b57\u5230\u8fd9\u4e2a\u70b9\u7684\u529b\u77e9\u548c\uff0c\u529b\u77e9\u53ef\u4ee5\u7406\u89e3\u4e3a\u8ddd\u79bb\u4e58\u4ee5\u6570\u5b57\u3002<\/p>\n<p>\u4e3e\u4e2a\u4f8b\u5b50\uff0c4139\u5c31\u662f\u6ee1\u8db3\u6761\u4ef6\u7684\u6570\u5b57\uff0c\u628a3\u5f53\u6210\u652f\u70b9\uff0c\u6211\u4eec\u6709\u8fd9\u6837\u7684\u7b49\u5f0f4 * 2 &#43; 1 *1 = 9 * 1\u3002<\/p>\n<p>\u5c0f\u660e\u60f3\u77e5\u9053\u5728\u4e00\u4e2a\u533a\u95f4[x,y]\u4e2d\uff0c\u6709\u591a\u5c11\u4e2a\u8fd9\u6837\u7684\u6570\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u3010\u8f93\u5165\u6570\u636e\u3011<\/p>\n<p>\u4e24\u4e2a\u6570\uff0c\u8868\u793ax,y\u3002 0 &lt;= x,y&lt;= 10<sup>18<\/sup>\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u3010\u8f93\u51fa\u6570\u636e\u3011<\/p>\n<p>\u4e00\u4e2a\u8f93\u51fa\uff0c\u8868\u793a\u533a\u95f4[x,y]\u4e2d\u6ee1\u8db3\u6761\u4ef6\u7684\u6570\u7684\u4e2a\u6570\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u3010\u6837\u4f8b\u8f93\u5165\u3011<\/p>\n<p>7604 24324<\/p>\n<p>&nbsp;<\/p>\n<p>\u3010\u6837\u4f8b\u8f93\u51fa\u3011<\/p>\n<p>897<\/p>\n<p>&nbsp;<\/p>\n<p>\u3010\u6570\u636e\u8303\u56f4\u3011<\/p>\n<p>0 &lt;= x,y&lt;= 10<sup>18<\/sup><\/p>\n<p><sup><br \/>\n<\/sup><\/p>\n<\/p>\n<p><img decoding=\"async\" src=\"\" alt=\"\" \/><\/p>\n<p>\n<\/p>\n<p><pre name=\"code\" class=\"cpp\">#include&lt;cstdio&gt;\n#include&lt;iostream&gt;\n#include&lt;cstring&gt;\n#include&lt;cstdlib&gt;\n#include&lt;functional&gt;\n#include&lt;algorithm&gt;\nusing namespace std;\n#define MAXS 810 + 10 +4000\n#define MAXx 1000000000000000000\n#define MAXI 30\nlong long f[MAXI][MAXS][2],depth,a[MAXI],ans,pos;\n  \/\/0 &lt;= \u53ea\u80fd\u53d6&lt;=\u7b2ci\u4f4d\u7684\u6570\uff0c\u5426\u5219\u8d85\u8fc7X\u8d8a\u754c    1 \u9ad8\u4f4d\u5df2\u7ecf\u53d6\u4e86\u66f4\u5c0f\u7684 \u4f4d\u6570 \u540e\u9762\u968f\u4fbf\u53d6\nlong long dfs(int i,int s,int c)\n{\n\n\tif (s&lt;0||s&gt;MAXS) return 0;\n\tif ((i==0)&amp;&amp;((s)||(c))) return 0;\n\tif (i==0) {\/\/cout&lt;&lt;i&lt;&lt;' '&lt;&lt;s&lt;&lt;' '&lt;&lt;c&lt;&lt;' '&lt;&lt;f[i][s][c]&lt;&lt;endl;\n\n\treturn 1;}\n\/\/\tcout&lt;&lt;i&lt;&lt;' '&lt;&lt;s&lt;&lt;' '&lt;&lt;c&lt;&lt;' '&lt;&lt;f[i][s][c]&lt;&lt;endl;\n\n\tif (f[i][s][c]&gt;=0) return f[i][s][c];\n\telse f[i][s][c]=0;\n\tif (!c)\n\t{\n\t\/\/\tcout&lt;&lt;&quot;push &quot;&lt;&lt;a[i]&lt;&lt;endl;\n\t\tf[i][s][c]+=dfs(i-1,s-(pos-i)*a[i],0);\n\t}\n\telse\n\t{\n\t\tfor (int k=0;k&lt;a[i];k++) \/\/{ cout&lt;&lt;&quot;push &quot;&lt;&lt;k&lt;&lt;endl;\n\t\tf[i][s][c]+=dfs(i-1,s-(pos-i)*k,0); \/\/ cout&lt;&lt;&quot;pop &quot;&lt;&lt;k&lt;&lt;endl;}\n\t\tfor (int k=0;k&lt;=9;k++)\/\/{  cout&lt;&lt;&quot;push &quot;&lt;&lt;k&lt;&lt;endl;\n\t\tf[i][s][c]+=dfs(i-1,s-(pos-i)*k,1); \/\/cout&lt;&lt;&quot;pop &quot;&lt;&lt;k&lt;&lt;endl;}\n\t}\n\n\treturn f[i][s][c];\n}\nlong long calc(long long x)\n{\n\n\tif (!x) return 0;  \/\/&lt;0\u7684\u6760\u6746\u6570\u4e3a0\n\tlong long ans=0;\n\tmemset(f,0,sizeof(f));\n\tdepth=0;\n\twhile (x)\n\t{\n\t\tdepth++;\n\t\ta[depth]=x%10;\n\t\tx=x\/10;\n\t}\n\tfor (int i=1;i&lt;=depth\/2;i++)\n\t{\n\t\tswap(a[i],a[depth-i+1]);\n\t}\n\tans=0;\n\tf[depth+1][0][0]=1;   \/\/ =29333\n\tf[depth+1][0][1]=1;\t  \/\/ &lt;29333\n\tfor (pos=1;pos&lt;=depth;pos++)\n\t{\n\t\tmemset(f,128,sizeof(f));\n\/\/\t\tcout&lt;&lt;f[19][0][0]&lt;&lt;endl;\n\t\tans+=\/*dfs(depth,0,0)+*\/dfs(depth,0,1);\n\t\tans--;\t\t\/\/\u4e0d\u8003\u8651 0 \u5b83\u65e0\u8bba\u652f\u70b9\u4e3a\u51e0\u90fd\u51fa\u73b0\n\t}\n\treturn ans+1;   \/\/\u6700\u540e \u52a0\u4e0a 0\n\/*\n\tf[i][s][c]=f[i-1][s-(k-i)*j][0]\n\n*\/\n}\nint main()\n{\n\tfreopen(&quot;number.in&quot;,&quot;r&quot;,stdin);\n\tfreopen(&quot;number.out&quot;,&quot;w&quot;,stdout);\n\tlong long x,y;\n\tscanf(&quot;%lld%lld&quot;,&amp;x,&amp;y);\n\tprintf(&quot;%lld&quot;,calc(y+1)-calc(x));\n\/\/\twhile (1);\n}<\/pre>\n<\/p>\n<p><\/p>\n<p><sup><br \/>\n<\/sup><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Number \u3010\u9898\u76ee\u63cf\u8ff0\u3011 \u660e\u660e\u5728\u505a\u529b\u5b66\u4f5c\u4e1a\u7684\u65f6\u5019\u53d1\u73b0\u4e00\u7c7b\u6570\u975e\u5e38\u6709\u8da3\uff0c\u4ed6\u4eec\u548c\u6760\u6746\u6709\u6bd4\u8f83\u76f8&#20284;\u7684\u7ed3\u6784 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","footnotes":""},"categories":[3],"tags":[29,30],"class_list":["post-202","post","type-post","status-publish","format-standard","hentry","category-defaultcategory","tag-c","tag-dp"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Number (dp-\u6027\u8d28\u6570\u72b6\u6001\u8868\u793a\uff09 - nike0good<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/nike0good.com\/?p=202\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Number (dp-\u6027\u8d28\u6570\u72b6\u6001\u8868\u793a\uff09 - nike0good\" \/>\n<meta property=\"og:description\" content=\"Number \u3010\u9898\u76ee\u63cf\u8ff0\u3011 \u660e\u660e\u5728\u505a\u529b\u5b66\u4f5c\u4e1a\u7684\u65f6\u5019\u53d1\u73b0\u4e00\u7c7b\u6570\u975e\u5e38\u6709\u8da3\uff0c\u4ed6\u4eec\u548c\u6760\u6746\u6709\u6bd4\u8f83\u76f8&#20284;\u7684\u7ed3\u6784 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/nike0good.com\/?p=202\" \/>\n<meta property=\"og:site_name\" content=\"nike0good\" \/>\n<meta property=\"article:published_time\" content=\"2012-10-20T14:46:00+00:00\" \/>\n<meta name=\"author\" content=\"nike0good\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"nike0good\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=202#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=202\"},\"author\":{\"name\":\"nike0good\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/#\\\/schema\\\/person\\\/4defa38da89de87e400861e73396baad\"},\"headline\":\"Number (dp-\u6027\u8d28\u6570\u72b6\u6001\u8868\u793a\uff09\",\"datePublished\":\"2012-10-20T14:46:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=202\"},\"wordCount\":22,\"commentCount\":0,\"keywords\":[\"C++\",\"DP\"],\"articleSection\":[\"DefaultCategory\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/nike0good.com\\\/?p=202#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=202\",\"url\":\"https:\\\/\\\/nike0good.com\\\/?p=202\",\"name\":\"Number (dp-\u6027\u8d28\u6570\u72b6\u6001\u8868\u793a\uff09 - nike0good\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/#website\"},\"datePublished\":\"2012-10-20T14:46:00+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/#\\\/schema\\\/person\\\/4defa38da89de87e400861e73396baad\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=202#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/nike0good.com\\\/?p=202\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=202#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/nike0good.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Number (dp-\u6027\u8d28\u6570\u72b6\u6001\u8868\u793a\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/#website\",\"url\":\"https:\\\/\\\/nike0good.com\\\/\",\"name\":\"nike0good\",\"description\":\"\u6709\u6240\u4f5c\u4e3a\u662f\u4eba\u751f\u7684\u6700\u9ad8\u5883\u754c\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/nike0good.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/#\\\/schema\\\/person\\\/4defa38da89de87e400861e73396baad\",\"name\":\"nike0good\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8e5fa08d5c367a1a6fb5ff13bb10ed5a331f981513256951290ae42322da6854?s=96&d=identicon&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8e5fa08d5c367a1a6fb5ff13bb10ed5a331f981513256951290ae42322da6854?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8e5fa08d5c367a1a6fb5ff13bb10ed5a331f981513256951290ae42322da6854?s=96&d=identicon&r=g\",\"caption\":\"nike0good\"},\"sameAs\":[\"https:\\\/\\\/nike0good.com\"],\"url\":\"https:\\\/\\\/nike0good.com\\\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Number (dp-\u6027\u8d28\u6570\u72b6\u6001\u8868\u793a\uff09 - nike0good","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/nike0good.com\/?p=202","og_locale":"zh_CN","og_type":"article","og_title":"Number (dp-\u6027\u8d28\u6570\u72b6\u6001\u8868\u793a\uff09 - nike0good","og_description":"Number \u3010\u9898\u76ee\u63cf\u8ff0\u3011 \u660e\u660e\u5728\u505a\u529b\u5b66\u4f5c\u4e1a\u7684\u65f6\u5019\u53d1\u73b0\u4e00\u7c7b\u6570\u975e\u5e38\u6709\u8da3\uff0c\u4ed6\u4eec\u548c\u6760\u6746\u6709\u6bd4\u8f83\u76f8&#20284;\u7684\u7ed3\u6784 [&hellip;]","og_url":"https:\/\/nike0good.com\/?p=202","og_site_name":"nike0good","article_published_time":"2012-10-20T14:46:00+00:00","author":"nike0good","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"nike0good","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/nike0good.com\/?p=202#article","isPartOf":{"@id":"https:\/\/nike0good.com\/?p=202"},"author":{"name":"nike0good","@id":"https:\/\/nike0good.com\/#\/schema\/person\/4defa38da89de87e400861e73396baad"},"headline":"Number (dp-\u6027\u8d28\u6570\u72b6\u6001\u8868\u793a\uff09","datePublished":"2012-10-20T14:46:00+00:00","mainEntityOfPage":{"@id":"https:\/\/nike0good.com\/?p=202"},"wordCount":22,"commentCount":0,"keywords":["C++","DP"],"articleSection":["DefaultCategory"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/nike0good.com\/?p=202#respond"]}]},{"@type":"WebPage","@id":"https:\/\/nike0good.com\/?p=202","url":"https:\/\/nike0good.com\/?p=202","name":"Number (dp-\u6027\u8d28\u6570\u72b6\u6001\u8868\u793a\uff09 - nike0good","isPartOf":{"@id":"https:\/\/nike0good.com\/#website"},"datePublished":"2012-10-20T14:46:00+00:00","author":{"@id":"https:\/\/nike0good.com\/#\/schema\/person\/4defa38da89de87e400861e73396baad"},"breadcrumb":{"@id":"https:\/\/nike0good.com\/?p=202#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/nike0good.com\/?p=202"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/nike0good.com\/?p=202#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/nike0good.com\/"},{"@type":"ListItem","position":2,"name":"Number (dp-\u6027\u8d28\u6570\u72b6\u6001\u8868\u793a\uff09"}]},{"@type":"WebSite","@id":"https:\/\/nike0good.com\/#website","url":"https:\/\/nike0good.com\/","name":"nike0good","description":"\u6709\u6240\u4f5c\u4e3a\u662f\u4eba\u751f\u7684\u6700\u9ad8\u5883\u754c","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/nike0good.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/nike0good.com\/#\/schema\/person\/4defa38da89de87e400861e73396baad","name":"nike0good","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/secure.gravatar.com\/avatar\/8e5fa08d5c367a1a6fb5ff13bb10ed5a331f981513256951290ae42322da6854?s=96&d=identicon&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/8e5fa08d5c367a1a6fb5ff13bb10ed5a331f981513256951290ae42322da6854?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8e5fa08d5c367a1a6fb5ff13bb10ed5a331f981513256951290ae42322da6854?s=96&d=identicon&r=g","caption":"nike0good"},"sameAs":["https:\/\/nike0good.com"],"url":"https:\/\/nike0good.com\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/nike0good.com\/index.php?rest_route=\/wp\/v2\/posts\/202","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nike0good.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nike0good.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nike0good.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nike0good.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=202"}],"version-history":[{"count":0,"href":"https:\/\/nike0good.com\/index.php?rest_route=\/wp\/v2\/posts\/202\/revisions"}],"wp:attachment":[{"href":"https:\/\/nike0good.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nike0good.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=202"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nike0good.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}