{"id":3803,"date":"2023-10-31T12:52:13","date_gmt":"2023-10-31T04:52:13","guid":{"rendered":"https:\/\/white-night.club\/?p=3803"},"modified":"2023-11-09T11:07:44","modified_gmt":"2023-11-09T03:07:44","slug":"ad116","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/10\/31\/ad116\/","title":{"rendered":"1716.\u00a0\u8ba1\u7b97\u529b\u6263\u94f6\u884c\u7684\u94b1"},"content":{"rendered":"\n<p>Hercy \u60f3\u8981\u4e3a\u8d2d\u4e70\u7b2c\u4e00\u8f86\u8f66\u5b58\u94b1\u3002\u4ed6\u00a0<strong>\u6bcf\u5929<\/strong>\u00a0\u90fd\u5f80\u529b\u6263\u94f6\u884c\u91cc\u5b58\u94b1\u3002<\/p>\n\n\n\n<p>\u6700\u5f00\u59cb\uff0c\u4ed6\u5728\u5468\u4e00\u7684\u65f6\u5019\u5b58\u5165&nbsp;<code>1<\/code>&nbsp;\u5757\u94b1\u3002\u4ece\u5468\u4e8c\u5230\u5468\u65e5\uff0c\u4ed6\u6bcf\u5929\u90fd\u6bd4\u524d\u4e00\u5929\u591a\u5b58\u5165&nbsp;<code>1<\/code>&nbsp;\u5757\u94b1\u3002\u5728\u63a5\u4e0b\u6765\u6bcf\u4e00\u4e2a\u5468\u4e00\uff0c\u4ed6\u90fd\u4f1a\u6bd4&nbsp;<strong>\u524d\u4e00\u4e2a\u5468\u4e00<\/strong>&nbsp;\u591a\u5b58\u5165&nbsp;<code>1<\/code>&nbsp;\u5757\u94b1\u3002<\/p>\n\n\n\n<p>\u7ed9\u4f60&nbsp;<code>n<\/code>&nbsp;\uff0c\u8bf7\u4f60\u8fd4\u56de\u5728\u7b2c&nbsp;<code>n<\/code>&nbsp;\u5929\u7ed3\u675f\u7684\u65f6\u5019\u4ed6\u5728\u529b\u6263\u94f6\u884c\u603b\u5171\u5b58\u4e86\u591a\u5c11\u5757\u94b1\u3002<\/p>\n\n\n\n<p><strong>\u793a\u4f8b 1\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165\uff1a<\/strong>n = 4\n<strong>\u8f93\u51fa\uff1a<\/strong>10\n<strong>\u89e3\u91ca\uff1a<\/strong>\u7b2c 4 \u5929\u540e\uff0c\u603b\u989d\u4e3a 1 + 2 + 3 + 4 = 10 \u3002\n<\/pre>\n\n\n\n<p><strong>\u793a\u4f8b 2\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165\uff1a<\/strong>n = 10\n<strong>\u8f93\u51fa\uff1a<\/strong>37\n<strong>\u89e3\u91ca\uff1a<\/strong>\u7b2c 10 \u5929\u540e\uff0c\u603b\u989d\u4e3a (1 + 2 + 3 + 4 + 5 + 6 + 7) + (2 + 3 + 4) = 37 \u3002\u6ce8\u610f\u5230\u7b2c\u4e8c\u4e2a\u661f\u671f\u4e00\uff0cHercy \u5b58\u5165 2 \u5757\u94b1\u3002\n<\/pre>\n\n\n\n<p><strong>\u793a\u4f8b 3\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165\uff1a<\/strong>n = 20\n<strong>\u8f93\u51fa\uff1a<\/strong>96\n<strong>\u89e3\u91ca\uff1a<\/strong>\u7b2c 20 \u5929\u540e\uff0c\u603b\u989d\u4e3a (1 + 2 + 3 + 4 + 5 + 6 + 7) + (2 + 3 + 4 + 5 + 6 + 7 + 8) + (3 + 4 + 5 + 6 + 7 + 8) = 96 \u3002\n<\/pre>\n\n\n\n<p><strong>\u63d0\u793a\uff1a<\/strong><\/p>\n\n\n\n<ul>\n<li><code>1 &lt;= n &lt;= 1000<\/code><\/li>\n<\/ul>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<blockquote class=\"wp-block-quote has-luminous-vivid-amber-color has-text-color\">\n<p>\u89e3\u9898\u601d\u8def<\/p>\n<cite><em>\u7b49\u5dee\u6570\u5217<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u592a\u4e45\u6ca1\u7528\u8fc7\u7b49\u5dee\u6570\u5217\u7684\u901a\u9879\u516c\u5f0f\u548c\u6c42\u548c\u516c\u5f0f\u4e86\uff0c\u5fd8\u90fd\u5fd8\u7684\u5dee\u4e0d\u591a\u4e86\u3002<\/p>\n\n\n\n<p>\u5148\u6c42\u524dn\u5468\u7684\u548c\u3002\u518d\u8ba1\u7b97\u5269\u4e0b\u7684n\u5929\u3002\u4e24\u8005\u90fd\u662f\u7b49\u5dee\u6570\u5217\u6240\u4ee5\u90fd\u53ef\u4ee5\u7528\u901a\u9879\u516c\u5f0f\u548c\u6c42\u548c\u516c\u5f0f\u3002\u5173\u952e\u5c31\u662f\u80fd\u4e0d\u80fd\u627e\u5230\u7b49\u5dee\u6570\u5217\u7684\u7b2c\u4e00\u9879\u3002\u6211\u4e00\u5f00\u59cb\u6ca1\u60f3\u5230\u7528\u7b49\u5dee\u6570\u5217\u6240\u4ee5\u60f3\u66b4\u529b\u60f3\u4e86\u597d\u4e45\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Solution {\r\npublic:\r\n    int totalMoney(int n) {\r\n        int week=n\/7;\r\n        int day=n%7;\r\n        int sum=0;\r\n        int lastweek=28+((week-1)*7);\r\n        sum=(week)*(28+lastweek)\/2;\r\n        int firstday=week+1;\r\n        int lastday=firstday+(day-1);\r\n        sum+=(day)*(firstday+lastday)\/2;\r\n        return sum;\r\n    }\r\n};<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Leetcode\u9898\u76ee\uff1a\u7b49\u5dee\u6570\u5217<\/p>\n","protected":false},"author":1,"featured_media":2827,"comment_status":"open","ping_status":"","sticky":false,"template":"base","format":"standard","meta":{"footnotes":""},"categories":[42,25],"tags":[38],"_links":{"self":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/3803"}],"collection":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/comments?post=3803"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/3803\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media\/2827"}],"wp:attachment":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media?parent=3803"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=3803"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=3803"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}