{"id":334,"date":"2018-11-05T14:35:24","date_gmt":"2018-11-05T06:35:24","guid":{"rendered":"http:\/\/SmokeyDays.top\/wordpress\/?p=334"},"modified":"2018-11-05T14:37:23","modified_gmt":"2018-11-05T06:37:23","slug":"abc113","status":"publish","type":"post","link":"http:\/\/SmokeyDays.top\/wordpress\/2018\/11\/05\/abc113\/","title":{"rendered":"ABC113"},"content":{"rendered":"<p>\u7b2c\u4e00\u6b21\u5c1d\u8bd5\u6253\\(AtCoder\\)\uff0c\u8003\u524d\u7d27\u5f20\u523a\u6fc0\u5730\u5bf9\u7740\\(google\\)\u5b66\u65e5\u8bed\uff0c\u4e0d\u8fc7\u771f\u6b63\u5230\u4e86\u5f00\u8003\u4e86\u8fd8\u662f\u82f1\u8bed\u8bfb\u8d77\u6765\u6bd4\u8f83\u9760\u8c31\u3002<\/p>\n<p>\\(Beginner\\)\u7684\u6bd4\u8d5b\u8fd8\u662f\u6bd4\u8f83\u6c34\u7684\uff0c\u6211\u6da8\u4e86\\(400pts\\)\uff0c\u4f3c\u4e4e\u662f\\(Beginner\\)\u80fd\u6da8\u5230\u7684\u6700\u9ad8\u5206\u4e86\uff1f\u4e0d\u592a\u6e05\u695a\u3002<\/p>\n<p>\\(ABC113 A &#8211; Discount Fare\\)<br \/>\n\u6253\u5361\u9898\uff0c\u6ca1\u4ec0\u4e48\u53ef\u8bf4\u7684\u3002<br \/>\n\\(ABC113 B &#8211; Palace\\)<br \/>\n\u5927\u529b\u6a21\u62df\u5373\u53ef\u3002<br \/>\n\\(ABC113 C &#8211; ID\\)<br \/>\n\u6392\u5e8f\u3002\u5584\u7528STL\u53ef\u4ee5\u9ad8\u6548\u5f97\u5206\u3002<br \/>\n\\(ABC113 D &#8211; Number of Amidakuji\\)<br \/>\n\u4e00\u9053\u6709\u4e00\u5b9a\u96be\u5ea6\u7684DP\u9898\u3002<br \/>\n\\(f_{i,j}\\)\u8868\u793a\uff0c\u8d70\u5230\\(f_{i,j}\\)\u5e76\u7528\u5b8c\u6a2a\u6760\u7684\u65b9\u6848\u6570\u3002<br \/>\n\u7136\u540e\u6211\u4eec\u53ef\u4ee5\u53d1\u73b0\uff0c\u8fd9\u79cd\u65b9\u6848\u6570\u662f\u53ef\u4ee5\u76f4\u63a5\u8ba1\u7b97\u51fa\u6765\u7684\u2014\u2014\u5177\u4f53\u6765\u8bf4\u8981\u4e58\u4e0a\u4e00\u4e2a\u6590\u6ce2\u90a3\u5951\u6570\u3002\u8fd9\u662f\u56e0\u4e3a\u653e\u7f6e\u4e1c\u897f\u7684\u65f6\u5019\u4e0d\u80fd\u540c\u884c\u3002<br \/>\n\u53ef\u4ee5\u7c7b\u6bd4\u722c\u697c\u68af\u95ee\u9898\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"cpp\">#include&lt;iostream&gt;\r\n#include&lt;cstdio&gt;\r\n#include&lt;cstring&gt;\r\n#include&lt;cmath&gt;\r\n#include&lt;algorithm&gt;\r\nusing namespace std;\r\n#define Max(_A,_B) (_A&gt;_B?_A:_B)\r\n#define Min(_A,_B) (_A&lt;_B?_A:_B)\r\n#define Abs(_A) ((_A)?(_A):(-(_A))\r\n#define INF 0x3f3f3f3f\r\n\/*\r\nABC113 A - Discount Fare\r\n*\/ \r\nlong long x,y;\r\nvoid init(){\r\n    scanf(\"%lld%lld\",&amp;x,&amp;y);\r\n    printf(\"%lld\",x+(y&gt;&gt;1));\r\n}\r\nint main(){\r\n\tinit();\r\n\treturn 0;\r\n}\r\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"cpp\">#include&lt;iostream&gt;\r\n#include&lt;cstdio&gt;\r\n#include&lt;cstring&gt;\r\n#include&lt;cmath&gt;\r\n#include&lt;algorithm&gt;\r\nusing namespace std;\r\n#define Max(_A,_B) (_A&gt;_B?_A:_B)\r\n#define Min(_A,_B) (_A&lt;_B?_A:_B)\r\n#define Abs(_A) ((_A)?(_A):(-(_A))\r\n#define INF 0x3f3f3f3f\r\n\/*\r\nABC113 B - Palace\r\n*\/ \r\nint n,loc[100005];\r\ndouble t,a,h[100005];\r\ninline double cmp(int a,int b){\r\n    return h[a]&lt;h[b];\r\n} \r\nvoid init(){\r\n    scanf(\"%d\",&amp;n);\r\n    scanf(\"%lf%lf\",&amp;t,&amp;a);\r\n    for(int i=1;i&lt;=n;++i){\r\n        scanf(\"%lf\",&amp;h[i]);\r\n        h[i]=t-h[i]*0.006;\r\n        h[i]-=a;\r\n        h[i]=(h[i]&lt;0)?(-h[i]):h[i];\r\n        loc[i]=i;\r\n    }\r\n    sort(loc+1,loc+1+n,cmp);\r\n    printf(\"%d\",loc[1]);\r\n}\r\nint main(){\r\n\tinit();\r\n\treturn 0;\r\n}\r\n<\/code><\/pre>\n<pre class=\"pure-highlightjs\"><code class=\"cpp\">#include&lt;iostream&gt;\r\n#include&lt;cstdio&gt;\r\n#include&lt;cstring&gt;\r\n#include&lt;cmath&gt;\r\n#include&lt;algorithm&gt;\r\n#include&lt;vector&gt;\r\nusing namespace std;\r\n#define Max(_A,_B) (_A&gt;_B?_A:_B)\r\n#define Min(_A,_B) (_A&lt;_B?_A:_B)\r\n#define Abs(_A) ((_A)?(_A):(-(_A))\r\n#define INF 0x3f3f3f3f\r\n\/*\r\nABC113 C - ID\r\n*\/ \r\nint n,m;\r\nstruct data{\r\n    int a;\r\n    int b;\r\n    int id;\r\n}tl[100005];\r\nvector&lt;data&gt; nl[100005];\r\ninline bool cmp(const data &amp;a,const data &amp;b){\r\n    return a.b&lt;b.b;\r\n}\r\ninline bool cmp2(const data &amp;a,const data &amp;b){\r\n    return a.id&lt;b.id;\r\n}\r\nvoid init(){\r\n    scanf(\"%d%d\",&amp;n,&amp;m);\r\n    int x,y;\r\n    data nw;\r\n    for(int i=1;i&lt;=m;++i){\r\n        scanf(\"%d%d\",&amp;x,&amp;y);\r\n        nw.b=y;\r\n        nw.id=i;\r\n        nw.a=x;\r\n        nl[x].push_back(nw);\r\n    }\r\n    for(int i=1;i&lt;=n;++i){\r\n        sort(nl[i].begin(),nl[i].end(),cmp);\r\n    }\r\n    int tp=0;\r\n    for(int i=1;i&lt;=n;++i){\r\n        for(int j=0;j&lt;nl[i].size();++j){\r\n            nl[i][j].b=j+1;\r\n            tl[++tp]=nl[i][j];\r\n        }\r\n    }\r\n    sort(tl+1,tl+1+m,cmp2);\r\n    for(int i=1;i&lt;=m;++i){\r\n        printf(\"%.6d%.6d\\n\",tl[i].a,tl[i].b);\r\n    }\r\n}\r\nint main(){\r\n\tinit();\r\n\treturn 0;\r\n}\r\n<\/code><\/pre>\n<pre class=\"pure-highlightjs\"><code class=\"cpp\">#include&lt;iostream&gt;\r\n#include&lt;cstdio&gt;\r\n#include&lt;cstring&gt;\r\n#include&lt;cmath&gt;\r\n#include&lt;algorithm&gt;\r\nusing namespace std;\r\n#define Max(_A,_B) (_A&gt;_B?_A:_B)\r\n#define Min(_A,_B) (_A&lt;_B?_A:_B)\r\n#define Abs(_A) ((_A)?(_A):(-(_A))\r\n#define INF 0x3f3f3f3f\r\n#define MOD 1000000007\r\n\/*\r\nABC113 D - Number of Amidakuji\r\n*\/\r\n\/\/w \u68cd\u5b50\uff0ck \u5217\u6570\u3002 \r\nlong long h,w,k;\r\nlong long ans=0;\r\nlong long f[105][10];\r\nlong long fib[1005];\r\n\/\/Y\u53d6X\u7684\u60c5\u51b5\u3002 \r\nvoid init(){\r\n    scanf(\"%lld%lld%lld\",&amp;h,&amp;w,&amp;k);\r\n    memset(f,0,sizeof(f));\r\n    fib[1]=fib[2]=1;\r\n    for(int i=3;i&lt;=1000;++i){\r\n        fib[i]=(fib[i-1]+fib[i-2])%MOD;\r\n    }\r\n    f[0][1]=1;\r\n    for(int i=1;i&lt;=h;++i){\r\n        for(int j=1;j&lt;=w;++j){\r\n            if(j&gt;1){\r\n                f[i][j]=(f[i][j]+(f[i-1][j-1]*fib[w-j+1]*fib[j-1])%MOD)%MOD;\r\n            }\r\n            if(j&lt;w){\r\n                f[i][j]=(f[i][j]+(f[i-1][j+1]*fib[w-j]*fib[j])%MOD)%MOD;\r\n            }\r\n            f[i][j]=(f[i][j]+(f[i-1][j]*fib[j]*fib[w-j+1])%MOD)%MOD;\r\n        }\r\n    }\r\n    printf(\"%lld\",f[h][k]);\r\n}\r\nint main(){\r\n\tinit();\r\n\treturn 0;\r\n}\r\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7b2c\u4e00\u6b21\u5c1d\u8bd5\u6253\\(AtCoder\\)\uff0c\u8003\u524d\u7d27\u5f20\u523a\u6fc0\u5730\u5bf9\u7740\\(google\\)\u5b66\u65e5\u8bed\uff0c\u4e0d\u8fc7\u771f\u6b63\u5230\u4e86\u5f00\u8003\u4e86\u8fd8\u662f\u82f1\u8bed\u8bfb &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/SmokeyDays.top\/wordpress\/2018\/11\/05\/abc113\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cABC113\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[13,14,5],"tags":[],"_links":{"self":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts\/334"}],"collection":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/comments?post=334"}],"version-history":[{"count":3,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts\/334\/revisions"}],"predecessor-version":[{"id":337,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts\/334\/revisions\/337"}],"wp:attachment":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/media?parent=334"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/categories?post=334"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/tags?post=334"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}