{"id":281,"date":"2012-11-20T22:28:00","date_gmt":"2012-11-20T14:28:00","guid":{"rendered":"http:\/\/nike0good.jp1.rpvhost.net\/186"},"modified":"2012-11-20T22:28:00","modified_gmt":"2012-11-20T14:28:00","slug":"tyvj_p2068_treasure_hunt","status":"publish","type":"post","link":"https:\/\/nike0good.com\/?p=281","title":{"rendered":"Tyvj P2068(\u5bfb\u5b9d\uff09"},"content":{"rendered":"<table class=\"table table-striped table-bordered  \" style=\"max-width:100%; background-color:white; border-spacing:0px; width:939px; margin-bottom:20px; border-width:1px 1px 1px 0px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-top-color:rgb(221,221,221); border-right-color:rgb(221,221,221); border-bottom-color:rgb(221,221,221); color:rgb(51,51,51); font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:14px; line-height:20px\">\n<thead style=\"color:black; font-family:\u5fae\u8f6f\u96c5\u9ed1\">\n<tr>\n<th colspan=\"2\" style=\"padding:8px; text-align:center; vertical-align:bottom; border-top-width:0px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(221,221,221)\">\n<h3 style=\"margin:10px 0px; font-family:inherit; line-height:40px; color:inherit; font-size:24px\">\nP2068 - [NOIP2012P2]\u5bfb\u5b9d<\/h3>\n<p>From&nbsp;<a href=\"http:\/\/www.tyvj.cn\/User_Show.aspx?id=28349\" style=\"color:rgb(0,136,204); text-decoration:none\"><span style=\"color:rgb(204,153,102)\">luchangzhou<\/span><\/a>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color:green\">Normal (OI)<\/span><br \/>\n\u603b\u65f6\u9650\uff1a10s &nbsp;&nbsp; \u5185\u5b58\u9650\u5236\uff1a128MB &nbsp;&nbsp; \u4ee3\u7801\u957f\u5ea6\u9650\u5236\uff1a64KB<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"padding:8px; text-align:left; vertical-align:top; border-top-width:1px; border-top-style:solid; border-top-color:rgb(221,221,221); border-left-width:1px; border-left-style:solid; border-left-color:rgb(221,221,221); background-color:rgb(249,249,249)\">\n<table class=\"table table-striped table-hover  \" style=\"max-width:100%; background-color:transparent; border-collapse:collapse; border-spacing:0px; width:679px; margin-bottom:20px\">\n<colgroup>\n<col \/><\/colgroup>\n<tbody>\n<tr>\n<td style=\"padding:8px; line-height:20px; text-align:left; vertical-align:top; border-top-width:0px; border-left-width:0px\">\n<h4 style=\"margin:10px 0px; font-family:inherit; color:inherit; font-size:18px\">\u80cc\u666f Background<\/h4>\n<div style=\"padding-left:10px\">NOIP&nbsp;2012&nbsp;\u666e\u53ca\u7ec4&nbsp;\u98982<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:8px; line-height:20px; text-align:left; vertical-align:top; border-top-width:1px; border-top-style:solid; border-top-color:rgb(221,221,221); border-left-width:0px\">\n<h4 style=\"margin:10px 0px; font-family:inherit; color:inherit; font-size:18px\">\u63cf\u8ff0 Description<\/h4>\n<div style=\"padding-left:10px\">\u4f20\u8bf4\u5f88\u9065\u8fdc\u7684\u85cf\u5b9d\u697c\u9876\u5c42\u85cf\u7740\u8bf1\u4eba\u7684\u5b9d\u85cf\u3002\u5c0f\u660e\u5386\u5c3d\u5343\u8f9b\u4e07\u82e6\u7ec8\u4e8e\u627e\u5230\u4f20\u8bf4\u4e2d\u7684\u8fd9\u4e2a\u85cf&nbsp;\u5b9d\u697c\uff0c\u85cf\u5b9d\u697c\u7684\u95e8\u53e3\u7ad6\u7740\u4e00\u4e2a\u6728\u677f\uff0c\u4e0a\u9762\u5199\u6709\u51e0\u4e2a\u5927\u5b57\uff1a\u5bfb\u5b9d\u8bf4\u660e\u4e66\u3002\u8bf4\u660e\u4e66\u7684\u5185\u5bb9\u5982\u4e0b\uff1a&nbsp;\u85cf\u5b9d\u697c\u5171\u6709&nbsp;N&#43;1&nbsp;\u5c42\uff0c\u6700\u4e0a\u9762\u4e00\u5c42\u662f\u9876\u5c42\uff0c\u9876\u5c42\u6709\u4e00\u4e2a\u623f\u95f4\u91cc\u9762\u85cf\u7740\u5b9d\u85cf\u3002\u9664\u4e86\u9876\u5c42\u5916\uff0c&nbsp;\u85cf\u5b9d\u697c\u53e6\u6709&nbsp;N&nbsp;\u5c42\uff0c\u6bcf\u5c42&nbsp;M&nbsp;\u4e2a\u623f\u95f4\uff0c\u8fd9&nbsp;M&nbsp;\u4e2a\u623f\u95f4\u56f4\u6210\u4e00\u5708\u5e76\u6309\u9006\u65f6\u9488\u65b9\u5411\u4f9d\u6b21\u7f16\u53f7\u4e3a&nbsp;0\uff0c\u2026\uff0c&nbsp;M-1\u3002\u5176\u4e2d\u4e00\u4e9b\u623f\u95f4\u6709\u901a\u5f80\u4e0a\u4e00\u5c42\u7684\u697c\u68af\uff0c\u6bcf\u5c42\u697c\u7684\u697c\u68af\u8bbe\u8ba1\u53ef\u80fd\u4e0d\u540c\u3002\u6bcf\u4e2a\u623f\u95f4\u91cc\u6709\u4e00\u4e2a&nbsp;\u6307\u793a\u724c\uff0c\u6307\u793a\u724c\u4e0a\u6709\u4e00\u4e2a\u6570\u5b57&nbsp;x\uff0c\u8868\u793a\u4ece\u8fd9\u4e2a\u623f\u95f4\u5f00\u59cb\u6309\u9006\u65f6\u9488\u65b9\u5411\u9009\u62e9\u7b2c&nbsp;x&nbsp;\u4e2a\u6709\u697c\u68af\u7684\u623f&nbsp;\u95f4\uff08\u5047\u5b9a\u8be5\u623f\u95f4\u7684\u7f16\u53f7\u4e3a&nbsp;k\uff09\uff0c\u4ece\u8be5\u623f\u95f4\u4e0a\u697c\uff0c\u4e0a\u697c\u540e\u5230\u8fbe\u4e0a\u4e00\u5c42\u7684&nbsp;k&nbsp;\u53f7\u623f\u95f4\u3002\u6bd4\u5982\u5f53\u524d\u623f&nbsp;\u95f4\u7684\u6307\u793a\u724c\u4e0a\u5199\u7740&nbsp;2\uff0c\u5219\u6309\u9006\u65f6\u9488\u65b9\u5411\u5f00\u59cb\u5c1d\u8bd5\uff0c\u627e\u5230\u7b2c&nbsp;2&nbsp;\u4e2a\u6709\u697c\u68af\u7684\u623f\u95f4\uff0c\u4ece\u8be5\u623f\u95f4\u4e0a\u697c\u3002&nbsp;\u5982\u679c\u5f53\u524d\u623f\u95f4\u672c\u8eab\u5c31\u6709\u697c\u68af\u901a\u5411\u4e0a\u5c42\uff0c\u8be5\u623f\u95f4\u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u6709\u697c\u68af\u7684\u623f\u95f4\u3002<\/p>\n<p>\u5bfb\u5b9d\u8bf4\u660e\u4e66\u7684\u6700\u540e\u7528\u7ea2\u8272\u5927\u53f7\u5b57\u4f53\u5199\u7740\uff1a\u201c\u5bfb\u5b9d\u987b\u77e5\uff1a\u5e2e\u52a9\u4f60\u627e\u5230\u6bcf\u5c42\u4e0a\u697c\u623f\u95f4\u7684\u6307\u793a&nbsp;\u724c\u4e0a\u7684\u6570\u5b57\uff08\u5373\u6bcf\u5c42\u7b2c\u4e00\u4e2a\u8fdb\u5165\u7684\u623f\u95f4\u5185\u6307\u793a\u724c\u4e0a\u7684\u6570\u5b57\uff09\u603b\u548c\u4e3a\u6253\u5f00\u5b9d\u7bb1\u7684\u5bc6\u94a5\u201d\u3002<\/p>\n<p>\u8bf7\u5e2e\u52a9\u5c0f\u660e\u7b97\u51fa\u8fd9\u4e2a\u6253\u5f00\u5b9d\u7bb1\u7684\u5bc6\u94a5\u3002<\/p><\/div>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:8px; line-height:20px; text-align:left; vertical-align:top; border-top-width:1px; border-top-style:solid; border-top-color:rgb(221,221,221); border-left-width:0px\">\n<h4 style=\"margin:10px 0px; font-family:inherit; color:inherit; font-size:18px\">\u8f93\u5165&#26684;\u5f0f InputFormat<\/h4>\n<div style=\"padding-left:10px\">\u7b2c\u4e00\u884c&nbsp;2&nbsp;\u4e2a\u6574\u6570&nbsp;N&nbsp;\u548c&nbsp;M\uff0c\u4e4b\u95f4\u7528\u4e00\u4e2a\u7a7a&#26684;\u9694\u5f00\u3002N&nbsp;\u8868\u793a\u9664\u4e86\u9876\u5c42\u5916\u85cf\u5b9d\u697c\u5171&nbsp;N&nbsp;\u5c42\u697c\uff0cM&nbsp;\u8868\u793a\u9664\u9876\u5c42\u5916\u6bcf\u5c42\u697c\u6709&nbsp;M&nbsp;\u4e2a\u623f\u95f4\u3002<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u63a5\u4e0b\u6765&nbsp;N*M&nbsp;\u884c\uff0c\u6bcf\u884c\u4e24\u4e2a\u6574\u6570\uff0c\u4e4b\u95f4\u7528\u4e00\u4e2a\u7a7a&#26684;\u9694\u5f00\uff0c\u6bcf\u884c\u63cf\u8ff0\u4e00\u4e2a\u623f\u95f4\u5185\u7684\u60c5\u51b5\uff0c&nbsp;\u5176\u4e2d\u7b2c(i-1)*M&#43;j&nbsp;\u884c\u8868\u793a\u7b2c&nbsp;i&nbsp;\u5c42&nbsp;j-1&nbsp;\u53f7\u623f\u95f4\u7684\u60c5\u51b5\uff08i=1,&nbsp;2,&nbsp;\u2026,&nbsp;N\uff1bj=1,&nbsp;2,&nbsp;\u2026&nbsp;,M\uff09\u3002\u7b2c\u4e00\u4e2a\u6574\u6570&nbsp;\u8868\u793a\u8be5\u623f\u95f4\u662f\u5426\u6709\u697c\u68af\u901a\u5f80\u4e0a\u4e00\u5c42\uff080&nbsp;\u8868\u793a\u6ca1\u6709\uff0c1&nbsp;\u8868\u793a\u6709\uff09\uff0c\u7b2c\u4e8c\u4e2a\u6574\u6570\u8868\u793a\u6307\u793a\u724c\u4e0a\u7684\u6570&nbsp;\u5b57\u3002\u6ce8\u610f\uff0c\u4ece&nbsp;j&nbsp;\u53f7\u623f\u95f4\u7684\u697c\u68af\u722c\u5230\u4e0a\u4e00\u5c42\u5230\u8fbe\u7684\u623f\u95f4\u4e00\u5b9a\u4e5f\u662f&nbsp;j&nbsp;\u53f7\u623f\u95f4\u3002<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u6700\u540e\u4e00\u884c\uff0c\u4e00\u4e2a\u6574\u6570\uff0c\u8868\u793a\u5c0f\u660e\u4ece\u85cf\u5b9d\u697c\u5e95\u5c42\u7684\u51e0\u53f7\u623f\u95f4\u8fdb\u5165\u5f00\u59cb\u5bfb\u5b9d\uff08\u6ce8\uff1a\u623f\u95f4\u7f16\u53f7&nbsp;\u4ece&nbsp;0&nbsp;\u5f00\u59cb\uff09\u3002<\/p><\/div>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:8px; line-height:20px; text-align:left; vertical-align:top; border-top-width:1px; border-top-style:solid; border-top-color:rgb(221,221,221); border-left-width:0px\">\n<h4 style=\"margin:10px 0px; font-family:inherit; color:inherit; font-size:18px\">\u8f93\u51fa&#26684;\u5f0f OutputFormat<\/h4>\n<div style=\"padding-left:10px\">\u8f93\u51fa\u53ea\u6709\u4e00\u884c\uff0c\u4e00\u4e2a\u6574\u6570\uff0c\u8868\u793a\u6253\u5f00\u5b9d\u7bb1\u7684\u5bc6\u94a5\uff0c\u8fd9\u4e2a\u6570\u53ef\u80fd\u4f1a\u5f88\u5927\uff0c\u8bf7\u8f93\u51fa\u5bf9&nbsp;20123\u53d6\u6a21\u7684\u7ed3\u679c\u5373\u53ef\u3002<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:8px; line-height:20px; text-align:left; vertical-align:top; border-top-width:1px; border-top-style:solid; border-top-color:rgb(221,221,221); border-left-width:0px\">\n<h4 style=\"margin:10px 0px; font-family:inherit; color:inherit; font-size:18px\">\u6837\u4f8b\u8f93\u5165 SampleInput&nbsp;<span style=\"font-size:14px\">[<a href=\"http:\/\/www.tyvj.cn\/Problem_Show.aspx?id=2068#\" style=\"color:rgb(0,136,204); text-decoration:none\">\u590d\u5236\u6570\u636e<\/a>]<\/span><\/h4>\n<div style=\"padding-left:10px\">\n<pre style=\"padding:9.5px; font-family:Monaco,Menlo,Consolas,'Courier New',monospace; font-size:13px; color:rgb(51,51,51); margin-top:0px; margin-bottom:10px; word-break:break-all; word-wrap:break-word; white-space:pre-wrap; background-color:rgb(245,245,245)\">2 3\n1 2\n0 3\n1 4\n0 1\n1 5\n1 2\n1<\/pre>\n<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:8px; line-height:20px; text-align:left; vertical-align:top; border-top-width:1px; border-top-style:solid; border-top-color:rgb(221,221,221); border-left-width:0px\">\n<h4 style=\"margin:10px 0px; font-family:inherit; color:inherit; font-size:18px\">\u6837\u4f8b\u8f93\u51fa SampleOutput&nbsp;<span style=\"font-size:14px\">[<a href=\"http:\/\/www.tyvj.cn\/Problem_Show.aspx?id=2068#\" style=\"color:rgb(0,136,204); text-decoration:none\">\u590d\u5236\u6570\u636e<\/a>]<\/span><\/h4>\n<div style=\"padding-left:10px\">\n<pre style=\"padding:9.5px; font-family:Monaco,Menlo,Consolas,'Courier New',monospace; font-size:13px; color:rgb(51,51,51); margin-top:0px; margin-bottom:10px; word-break:break-all; word-wrap:break-word; white-space:pre-wrap; background-color:rgb(245,245,245)\">5<\/pre>\n<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:8px; line-height:20px; text-align:left; vertical-align:top; border-top-width:1px; border-top-style:solid; border-top-color:rgb(221,221,221); border-left-width:0px\">\n<h4 style=\"margin:10px 0px; font-family:inherit; color:inherit; font-size:18px\">\u6570\u636e\u8303\u56f4\u548c\u6ce8\u91ca Hint<\/h4>\n<div style=\"padding-left:10px\">\u3010\u8f93\u5165\u8f93\u51fa\u6837\u4f8b\u8bf4\u660e\u3011<\/p>\n<p>\n\u7b2c\u4e00\u5c42\uff1a<\/p>\n<p>0&nbsp;\u53f7\u623f\u95f4\uff0c\u6709\u697c\u68af\u901a\u5f80\u4e0a\u5c42\uff0c\u6307\u793a\u724c\u4e0a\u7684\u6570\u5b57\u662f&nbsp;2\uff1b<\/p>\n<p>1&nbsp;\u53f7\u623f\u95f4\uff0c\u65e0\u697c\u68af\u901a\u5f80\u4e0a\u5c42\uff0c\u6307\u793a\u724c\u4e0a\u7684\u6570\u5b57\u662f&nbsp;3\uff1b<\/p>\n<p>2&nbsp;\u53f7\u623f\u95f4\uff0c\u6709\u697c\u68af\u901a\u5f80\u4e0a\u5c42\uff0c\u6307\u793a\u724c\u4e0a\u7684\u6570\u5b57\u662f&nbsp;4\uff1b<\/p>\n<p>\u7b2c\u4e8c\u5c42\uff1a<\/p>\n<p>0&nbsp;\u53f7\u623f\u95f4\uff0c\u65e0\u697c\u68af\u901a\u5f80\u4e0a\u5c42\uff0c\u6307\u793a\u724c\u4e0a\u7684\u6570\u5b57\u662f&nbsp;1\uff1b<\/p>\n<p>1&nbsp;\u53f7\u623f\u95f4\uff0c\u6709\u697c\u68af\u901a\u5f80\u4e0a\u5c42\uff0c\u6307\u793a\u724c\u4e0a\u7684\u6570\u5b57\u662f&nbsp;5\uff1b<\/p>\n<p>2&nbsp;\u53f7\u623f\u95f4\uff0c\u6709\u697c\u68af\u901a\u5f80\u4e0a\u5c42\uff0c\u6307\u793a\u724c\u4e0a\u7684\u6570\u5b57\u662f&nbsp;2\uff1b<\/p>\n<p>\u5c0f\u660e\u9996\u5148\u8fdb\u5165\u7b2c\u4e00\u5c42\uff08\u5e95\u5c42\uff09\u7684&nbsp;1&nbsp;\u53f7\u623f\u95f4\uff0c\u8bb0\u4e0b\u6307\u793a\u724c\u4e0a\u7684\u6570\u5b57\u4e3a&nbsp;3\uff0c\u7136\u540e\u4ece\u8fd9\u4e2a\u623f\u95f4&nbsp;\u5f00\u59cb\uff0c\u6cbf\u9006\u65f6\u9488\u65b9\u5411\u9009\u62e9\u7b2c&nbsp;3&nbsp;\u4e2a\u6709\u697c\u68af\u7684\u623f\u95f4&nbsp;2&nbsp;\u53f7\u623f\u95f4\u8fdb\u5165\uff0c\u4e0a\u697c\u540e\u5230\u8fbe\u7b2c\u4e8c\u5c42\u7684&nbsp;2&nbsp;\u53f7\u623f\u95f4\uff0c&nbsp;\u8bb0\u4e0b\u6307\u793a\u724c\u4e0a\u7684\u6570\u5b57\u4e3a&nbsp;2\uff0c\u7531\u4e8e\u5f53\u524d\u623f\u95f4\u672c\u8eab\u6709\u697c\u68af\u901a\u5411\u4e0a\u5c42\uff0c\u8be5\u623f\u95f4\u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u6709\u697c\u68af\u7684&nbsp;\u623f\u95f4\u3002\u56e0\u6b64\uff0c\u6b64\u65f6\u6cbf\u9006\u65f6\u9488\u65b9\u5411\u9009\u62e9\u7b2c&nbsp;2&nbsp;\u4e2a\u6709\u697c\u68af\u7684\u623f\u95f4\u5373\u4e3a&nbsp;1&nbsp;\u53f7\u623f\u95f4\uff0c\u8fdb\u5165\u540e\u4e0a\u697c\u68af\u5230\u8fbe&nbsp;\u9876\u5c42\u3002\u8fd9\u65f6\u628a\u4e0a\u8ff0\u8bb0\u4e0b\u7684\u6307\u793a\u724c\u4e0a\u7684\u6570\u5b57\u52a0\u8d77\u6765\uff0c\u5373&nbsp;3&#43;2=5\uff0c\u6240\u4ee5\u6253\u5f00\u5b9d\u7bb1\u7684\u5bc6\u94a5\u5c31\u662f&nbsp;5\u3002<\/p>\n<p>\u3010\u6570\u636e\u8303\u56f4\u3011<\/p>\n<p>\u5bf9\u4e8e&nbsp;50%\u6570\u636e\uff0c\u6709&nbsp;0&lt;N\u22641000\uff0c0&lt;x\u226410000\uff1b<\/p>\n<p>\u5bf9\u4e8e&nbsp;100%\u6570\u636e\uff0c\u6709&nbsp;0&lt;N\u226410000\uff0c0&lt;M\u2264100\uff0c0&lt;x\u22641,000,000\uff1b<\/p><\/div>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:8px; line-height:20px; text-align:left; vertical-align:top; border-top-width:1px; border-top-style:solid; border-top-color:rgb(221,221,221); border-left-width:0px; background-color:rgb(245,245,245)\">\n<h4 style=\"margin:10px 0px; font-family:inherit; color:inherit; font-size:18px\">\u6765\u6e90 Source<\/h4>\n<div style=\"padding-left:10px\">NOIP&nbsp;2012<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-size:14px\">\u7eaf\u7cb9\u7684\u6a21\u62df\u9898\uff0c\u7531\u4e8ex\u5f88\u5927\u4f46M\u5f88\u5c0f\uff0c\u53ef\u4ee5%tot[i]<\/span><\/p>\n<p><span style=\"font-size:14px\">\u4f46\u662f\u8fd9\u4e48\u505a\u53ef\u80fd\u53d8\u4e3a0.<\/span><\/p>\n<p><span style=\"font-size:14px\"><img decoding=\"async\" src=\"http:\/\/nike0good.jp1.rpvhost.net\/wp-content\/uploads\/csdn\/other_site\/img_my_1353421193_8218.png\" alt=\"\" \/><br \/>\n<\/span><\/p>\n<p><span style=\"font-size:14px\"><br \/>\n<\/span><\/p>\n<p><span style=\"font-size:14px\"><\/span><\/p>\n<pre name=\"code\" class=\"cpp\">#include&lt;cstdio&gt;\n#include&lt;cstring&gt;\n#include&lt;iostream&gt;\n#include&lt;cstdlib&gt;\n#include&lt;cmath&gt;\n#include&lt;cctype&gt;\n#include&lt;functional&gt;\n#include&lt;algorithm&gt;\nusing namespace std;\n#define MAXN (10000+10)\n#define MAXM (100+10)\n#define MAXX (1000000+10)\n#define F (20123)\n#define NDEBUG\nint n,m;\nint a[MAXN][MAXM],tot[MAXN]={0};\nbool b[MAXN][MAXM]={0};\nint main()\n{\n\t#ifndef NDEBUG\n\tfreopen(&quot;wealth.in&quot;,&quot;r&quot;,stdin);\n\t#endif\n\tscanf(&quot;%d%d&quot;,&amp;n,&amp;m);\n\tfor (int i=1;i&lt;=n;i++)\n\t\tfor (int j=0;j&lt;=m-1;j++)\n\t\t{\n\t\t\tscanf(&quot;%d%d&quot;,&amp;b[i][j],&amp;a[i][j]);\n\t\t\ttot[i]+=b[i][j];\n\t\t}\n\t#ifndef NDEBUG\n\tfor (int i=1;i&lt;=n;i++) cout&lt;&lt;tot[i]&lt;&lt;' ';\n\t#endif\n\tint x,ans=0;\n\tscanf(&quot;%d&quot;,&amp;x);\n\tfor (int i=1;i&lt;=n;i++)\n\t{\n\t\tans=(ans+a[i][x])%F;\n\t\tint len=a[i][x]%tot[i];\n\t\tif (len==0) len=tot[i];\n\t\twhile(len)\n\t\t{\n\t\t\tlen-=b[i][x];\n\t\t\tif (len==0) break;\n\t\t\tx=(x+1)%m;\n\t\t}\n\t}\n\/\/\tcout&lt;&lt;x&lt;&lt;endl;\n\tcout&lt;&lt;ans&lt;&lt;endl;\n\treturn 0;\n}<\/pre><\/p>\n","protected":false},"excerpt":{"rendered":"<p>P2068 &#8211; [NOIP2012P2]\u5bfb\u5b9d From&nbsp;luchangzhou&nbsp;&#038;nbsp [&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":[99],"class_list":["post-281","post","type-post","status-publish","format-standard","hentry","category-defaultcategory","tag-simulation"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Tyvj P2068(\u5bfb\u5b9d\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=281\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Tyvj P2068(\u5bfb\u5b9d\uff09 - nike0good\" \/>\n<meta property=\"og:description\" content=\"P2068 - [NOIP2012P2]\u5bfb\u5b9d From&nbsp;luchangzhou&nbsp;&amp;nbsp [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/nike0good.com\/?p=281\" \/>\n<meta property=\"og:site_name\" content=\"nike0good\" \/>\n<meta property=\"article:published_time\" content=\"2012-11-20T14:28:00+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/nike0good.jp1.rpvhost.net\/wp-content\/uploads\/csdn\/other_site\/img_my_1353421193_8218.png\" \/>\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=281#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=281\"},\"author\":{\"name\":\"nike0good\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/#\\\/schema\\\/person\\\/4defa38da89de87e400861e73396baad\"},\"headline\":\"Tyvj P2068(\u5bfb\u5b9d\uff09\",\"datePublished\":\"2012-11-20T14:28:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=281\"},\"wordCount\":193,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=281#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/nike0good.jp1.rpvhost.net\\\/wp-content\\\/uploads\\\/csdn\\\/other_site\\\/img_my_1353421193_8218.png\",\"keywords\":[\"\u6a21\u62df\"],\"articleSection\":[\"DefaultCategory\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/nike0good.com\\\/?p=281#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=281\",\"url\":\"https:\\\/\\\/nike0good.com\\\/?p=281\",\"name\":\"Tyvj P2068(\u5bfb\u5b9d\uff09 - nike0good\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=281#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=281#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/nike0good.jp1.rpvhost.net\\\/wp-content\\\/uploads\\\/csdn\\\/other_site\\\/img_my_1353421193_8218.png\",\"datePublished\":\"2012-11-20T14:28:00+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/#\\\/schema\\\/person\\\/4defa38da89de87e400861e73396baad\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=281#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/nike0good.com\\\/?p=281\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=281#primaryimage\",\"url\":\"http:\\\/\\\/nike0good.jp1.rpvhost.net\\\/wp-content\\\/uploads\\\/csdn\\\/other_site\\\/img_my_1353421193_8218.png\",\"contentUrl\":\"http:\\\/\\\/nike0good.jp1.rpvhost.net\\\/wp-content\\\/uploads\\\/csdn\\\/other_site\\\/img_my_1353421193_8218.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=281#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/nike0good.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tyvj P2068(\u5bfb\u5b9d\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":"Tyvj P2068(\u5bfb\u5b9d\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=281","og_locale":"zh_CN","og_type":"article","og_title":"Tyvj P2068(\u5bfb\u5b9d\uff09 - nike0good","og_description":"P2068 - [NOIP2012P2]\u5bfb\u5b9d From&nbsp;luchangzhou&nbsp;&nbsp [&hellip;]","og_url":"https:\/\/nike0good.com\/?p=281","og_site_name":"nike0good","article_published_time":"2012-11-20T14:28:00+00:00","og_image":[{"url":"http:\/\/nike0good.jp1.rpvhost.net\/wp-content\/uploads\/csdn\/other_site\/img_my_1353421193_8218.png","type":"","width":"","height":""}],"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=281#article","isPartOf":{"@id":"https:\/\/nike0good.com\/?p=281"},"author":{"name":"nike0good","@id":"https:\/\/nike0good.com\/#\/schema\/person\/4defa38da89de87e400861e73396baad"},"headline":"Tyvj P2068(\u5bfb\u5b9d\uff09","datePublished":"2012-11-20T14:28:00+00:00","mainEntityOfPage":{"@id":"https:\/\/nike0good.com\/?p=281"},"wordCount":193,"commentCount":0,"image":{"@id":"https:\/\/nike0good.com\/?p=281#primaryimage"},"thumbnailUrl":"http:\/\/nike0good.jp1.rpvhost.net\/wp-content\/uploads\/csdn\/other_site\/img_my_1353421193_8218.png","keywords":["\u6a21\u62df"],"articleSection":["DefaultCategory"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/nike0good.com\/?p=281#respond"]}]},{"@type":"WebPage","@id":"https:\/\/nike0good.com\/?p=281","url":"https:\/\/nike0good.com\/?p=281","name":"Tyvj P2068(\u5bfb\u5b9d\uff09 - nike0good","isPartOf":{"@id":"https:\/\/nike0good.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/nike0good.com\/?p=281#primaryimage"},"image":{"@id":"https:\/\/nike0good.com\/?p=281#primaryimage"},"thumbnailUrl":"http:\/\/nike0good.jp1.rpvhost.net\/wp-content\/uploads\/csdn\/other_site\/img_my_1353421193_8218.png","datePublished":"2012-11-20T14:28:00+00:00","author":{"@id":"https:\/\/nike0good.com\/#\/schema\/person\/4defa38da89de87e400861e73396baad"},"breadcrumb":{"@id":"https:\/\/nike0good.com\/?p=281#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/nike0good.com\/?p=281"]}]},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/nike0good.com\/?p=281#primaryimage","url":"http:\/\/nike0good.jp1.rpvhost.net\/wp-content\/uploads\/csdn\/other_site\/img_my_1353421193_8218.png","contentUrl":"http:\/\/nike0good.jp1.rpvhost.net\/wp-content\/uploads\/csdn\/other_site\/img_my_1353421193_8218.png"},{"@type":"BreadcrumbList","@id":"https:\/\/nike0good.com\/?p=281#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/nike0good.com\/"},{"@type":"ListItem","position":2,"name":"Tyvj P2068(\u5bfb\u5b9d\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\/281","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=281"}],"version-history":[{"count":0,"href":"https:\/\/nike0good.com\/index.php?rest_route=\/wp\/v2\/posts\/281\/revisions"}],"wp:attachment":[{"href":"https:\/\/nike0good.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nike0good.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=281"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nike0good.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}