{"id":27568,"date":"2024-10-27T14:41:59","date_gmt":"2024-10-27T14:41:59","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=27568"},"modified":"2024-11-26T07:17:13","modified_gmt":"2024-11-26T07:17:13","slug":"c-%ec%bd%94%eb%94%a9%ed%85%8c%ec%8a%a4%ed%8a%b8-%ea%b0%95%ec%a2%8c-%ea%b5%ac%ea%b0%84-%ed%95%a9-%ea%b5%ac%ed%95%98%ea%b8%b0-3-2","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/27568\/","title":{"rendered":"C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \uad6c\uac04 \ud569 \uad6c\ud558\uae30 3"},"content":{"rendered":"<p><body><\/p>\n<div class=\"problem\">\n<h2>\ubb38\uc81c<\/h2>\n<p>\n            \uc8fc\uc5b4\uc9c4 \uc815\uc218 \ubc30\uc5f4 <code>arr<\/code>\uc640 \ub450 \uac1c\uc758 \uc815\uc218 <code>left<\/code>, <code>right<\/code>\uac00 \uc788\uc2b5\ub2c8\ub2e4.<br \/>\n            \uc774 \ub54c, <code>arr[left] + arr[left + 1] + ... + arr[right]<\/code>\uc758 \uac12\uc744 \uacc4\uc0b0\ud558\ub294 \ud568\uc218\ub97c \uc791\uc131\ud558\uc2dc\uc624.<\/p>\n<p>            \ub2e8, <code>arr<\/code>\ub294 1 \u2264 <code>arr.length<\/code> \u2264 100,000\uc758 \ubc94\uc704\ub97c \uac00\uc9c0\uba70,<br \/>\n            \uac01 \uc6d0\uc18c\ub294 -10^9 \u2264 <code>arr[i]<\/code> \u2264 10^9\uae4c\uc9c0\uc758 \ubc94\uc704\ub97c \uac00\uc9d1\ub2c8\ub2e4.<\/p>\n<p>            \uc5ec\ub7ec\ubd84\uc740 O(log N) \ud639\uc740 O(1)\uc758 \uc2dc\uac04 \ubcf5\uc7a1\ub3c4\ub85c \uad6c\uac04 \ud569\uc744 \uad6c\ud560 \uc218 \uc788\ub294 \ud6a8\uc728\uc801\uc778 \ubc29\ubc95\uc744 \ucc3e\ub294 \uac83\uc744 \ubaa9\ud45c\ub85c \ud569\ub2c8\ub2e4.\n        <\/p>\n<\/div>\n<h2>\ubb38\uc81c \uc811\uadfc \ubc29\ubc95<\/h2>\n<p>\n        \uad6c\uac04 \ud569 \ubb38\uc81c\ub294 \uc5ec\ub7ec \uac00\uc9c0 \ubc29\ubc95\uc73c\ub85c \ud574\uacb0\ud560 \uc218 \uc788\uc9c0\ub9cc, \ud6a8\uc728\uc801\uc778 \ubc29\ubc95\uc73c\ub85c\ub294<br \/>\n        <strong>\ub204\uc801 \ud569(Prefix Sum)<\/strong>\uc744 \ud65c\uc6a9\ud55c \uc811\uadfc \ubc29\uc2dd\uc774 \uc788\uc2b5\ub2c8\ub2e4. \ub204\uc801 \ud569\uc744 \ud1b5\ud574 \uc8fc\uc5b4\uc9c4 \uad6c\uac04<br \/>\n        <code>[left, right]<\/code>\uc758 \ud569\uc744 O(1)\uc758 \uc2dc\uac04 \ubcf5\uc7a1\ub3c4\ub85c \uacc4\uc0b0\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<p>        \uae30\ubcf8\uc801\uc778 \uc544\uc774\ub514\uc5b4\ub294 \ubc30\uc5f4\uc758 \uac01 \uc778\ub371\uc2a4\uae4c\uc9c0\uc758 \ud569\uc744 \ubbf8\ub9ac \uacc4\uc0b0\ud558\uc5ec \uc800\uc7a5\ud558\ub294 \uac83\uc785\ub2c8\ub2e4.<br \/>\n        \uc774\ub97c \ud1b5\ud574 \ud2b9\uc815 \uad6c\uac04\uc758 \ud569\uc740 \ub2e4\uc74c\uacfc \uac19\uc774 \uad6c\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<p><code>sum(left, right) = prefixSum[right] - prefixSum[left - 1]<\/code><\/p>\n<p>        \uc5ec\uae30\uc11c <code>prefixSum[i]<\/code>\ub294 \ubc30\uc5f4\uc758 \ucc98\uc74c\ubd80\ud130 <code>i<\/code>\ubc88\uc9f8 \uc694\uc18c\uae4c\uc9c0\uc758 \ud569\uc785\ub2c8\ub2e4.<br \/>\n        \uc774 \ubc29\ubc95\uc740 \ubc30\uc5f4\uc744 \ud55c \ubc88 \uc21c\ud68c\ud558\ub294 O(N)\uc758 \ubcf5\uc7a1\ub3c4\ub97c \uac00\uc9c0\uace0 \uc788\uc73c\uba70, \uc774\ud6c4 \uac01 \uad6c\uac04 \ud569\uc740 O(1)\ub85c \uacc4\uc0b0\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.\n    <\/p>\n<h2>\uad6c\ud604<\/h2>\n<h3>\ucf54\ub4dc<\/h3>\n<pre>\n#include &lt;iostream&gt;\n#include &lt;vector&gt;\n\nusing namespace std;\n\nclass SubarraySum {\npublic:\n    SubarraySum(const vector&lt;int&gt;&amp; arr) {\n        int n = arr.size();\n        prefixSum.resize(n + 1);\n        prefixSum[0] = 0; \/\/ prefixSum[0]\uc740 0\uc73c\ub85c \ucd08\uae30\ud654\ud569\ub2c8\ub2e4.\n        \n        for (int i = 1; i &lt;= n; i++) {\n            prefixSum[i] = prefixSum[i - 1] + arr[i - 1];\n        }\n    }\n\n    int getSum(int left, int right) {\n        return prefixSum[right] - prefixSum[left - 1];\n    }\n\nprivate:\n    vector&lt;int&gt; prefixSum; \/\/ \ub204\uc801 \ud569\uc744 \uc800\uc7a5\ud558\ub294 \ubc30\uc5f4\uc785\ub2c8\ub2e4.\n};\n\nint main() {\n    int n; \/\/ \ubc30\uc5f4\uc758 \ud06c\uae30\n    cout &lt;&lt; \"\ubc30\uc5f4\uc758 \ud06c\uae30\ub97c \uc785\ub825\ud558\uc138\uc694: \";\n    cin &gt;&gt; n;\n    vector&lt;int&gt; arr(n);\n    cout &lt;&lt; \"\ubc30\uc5f4\uc758 \uc6d0\uc18c\ub97c \uc785\ub825\ud558\uc138\uc694: \";\n    for (int i = 0; i &lt; n; i++) {\n        cin &gt;&gt; arr[i];\n    }\n\n    SubarraySum subarray(arr);\n\n    int left, right;\n    cout &lt;&lt; \"\uad6c\uac04\uc758 \uc67c\ucabd \uacbd\uacc4\ub97c \uc785\ub825\ud558\uc138\uc694 (1\ubd80\ud130 \uc2dc\uc791): \";\n    cin &gt;&gt; left;\n    cout &lt;&lt; \"\uad6c\uac04\uc758 \uc624\ub978\ucabd \uacbd\uacc4\ub97c \uc785\ub825\ud558\uc138\uc694: \";\n    cin &gt;&gt; right;\n\n    int result = subarray.getSum(left, right);\n    cout &lt;&lt; \"\uad6c\uac04 [\" &lt;&lt; left &lt;&lt; \", \" &lt;&lt; right &lt;&lt; \"]\uc758 \ud569\uc740: \" &lt;&lt; result &lt;&lt; endl;\n\n    return 0;\n}\n    <\/pre>\n<h2>\ucf54\ub4dc \uc124\uba85<\/h2>\n<h3>\ud074\ub798\uc2a4 \uc815\uc758<\/h3>\n<p>\n<code>SubarraySum<\/code> \ud074\ub798\uc2a4\ub294 \uad6c\uac04 \ud569\uc744 \uacc4\uc0b0\ud558\ub294 \uae30\ub2a5\uc744 \uc81c\uacf5\ud569\ub2c8\ub2e4.<br \/>\n        \uc774 \ud074\ub798\uc2a4\uc758 \uc0dd\uc131\uc790\uc5d0\uc11c \ubc30\uce58\ub41c \ubc30\uc5f4\uc758 \uc6d0\uc18c\ub97c \uae30\ubc18\uc73c\ub85c \ub204\uc801 \ud569\uc744 \ucd08\uae30\ud654\ud569\ub2c8\ub2e4.<br \/>\n        \ubc30\uc5f4\uc758 \ud06c\uae30\ub97c \uc800\uc7a5\ud558\ub294 <code>n<\/code> \ubcc0\uc218\ub97c \uc815\uc758\ud558\uace0, <code>prefixSum<\/code> \ubc30\uc5f4\uc744(`[0]`\uc744 \ud558\ub098 \ud3ec\ud568\ud558\uc5ec) \uc0dd\uc131\ud569\ub2c8\ub2e4.\n    <\/p>\n<h3>\ub204\uc801 \ud569 \uacc4\uc0b0<\/h3>\n<p>\n        \uc0dd\uc131\uc790 \ub0b4\ubd80\uc758 <code>for<\/code> \ub8e8\ud504\ub97c \ud1b5\ud574 \ubc30\uc5f4\uc744 \uc21c\ud68c\ud558\uc5ec<br \/>\n        \uac01 \uc778\ub371\uc2a4\uae4c\uc9c0\uc758 \ud569\uc744 <code>prefixSum<\/code> \ubc30\uc5f4\uc5d0 \uc800\uc7a5\ud569\ub2c8\ub2e4.<br \/>\n        \uc774\ub294 \ubc30\uc5f4\uc758 \uccab \ubc88\uc9f8 \uc778\ub371\uc2a4\ubd80\ud130 \uc2dc\uc791\ud558\uae30 \ub54c\ubb38\uc5d0 \ubc30\uc5f4\uc758 \ud06c\uae30\ubcf4\ub2e4 1 \ud070 \ud06c\uae30\ub97c \uac00\uc9c0\ub294 \uac83\uc774 \ud2b9\uc9d5\uc785\ub2c8\ub2e4.\n    <\/p>\n<h3>\uad6c\uac04 \ud569 \uacc4\uc0b0<\/h3>\n<p>\n<code>getSum(int left, int right)<\/code> \uba54\uc18c\ub4dc\ub294 \uc8fc\uc5b4\uc9c4 <code>left<\/code>\uc640 <code>right<\/code> \uc778\ub371\uc2a4\ub97c<br \/>\n        \uc0ac\uc6a9\ud558\uc5ec \uad6c\uac04 \ud569\uc744 \ubc18\ud658\ud569\ub2c8\ub2e4. \ub204\uc801 \ud569 \ubc30\uc5f4\uc758 \uac12\uc744 \uc774\uc6a9\ud558\uc5ec \uac04\ub2e8\ud788<br \/>\n        <code>prefixSum[right] - prefixSum[left - 1]<\/code> \ub85c \uad6c\uac04 \ud569\uc744 \uacc4\uc0b0\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.\n    <\/p>\n<h2>\ud14c\uc2a4\ud2b8 \ubc0f \ud65c\uc6a9<\/h2>\n<p>\n        \ubcf8 \ucf54\ub4dc\ub97c \ud1b5\ud574 \uc0ac\uc6a9\uc790\ub294 \uad6c\uac04\uc758 \uc67c\ucabd\uacfc \uc624\ub978\ucabd \uacbd\uacc4\ub97c \uc785\ub825\ubc1b\uace0,<br \/>\n        \ud574\ub2f9 \uad6c\uac04\uc758 \ud569\uc744 \uc27d\uac8c \uacc4\uc0b0\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc774 \uc54c\uace0\ub9ac\uc998\uc740 \uc785\ub825 \ubc30\uc5f4\uc758 \ud06c\uae30\uac00 \ucee4\uc838\ub3c4<br \/>\n        \ub9e4\ub044\ub7fd\uac8c \ub3d9\uc791\ud558\uba70, \uad6c\uac04 \ud569\uc744 O(1)\uc758 \uc2dc\uac04 \ubcf5\uc7a1\ub3c4\ub85c \uc2e0\uc18d\ud558\uac8c \ucc98\ub9ac\ud560 \uc218 \uc788\ub294 \uc7a5\uc810\uc744 \uac00\uc9d1\ub2c8\ub2e4.\n    <\/p>\n<h2>\uacb0\ub860<\/h2>\n<p>\n        \uad6c\uac04 \ud569 \ubb38\uc81c\ub294 \ub2e4\uc591\ud55c \uc751\uc6a9 \ud504\ub85c\uadf8\ub7a8\uc5d0\uc11c\ub3c4 \ub110\ub9ac \uc0ac\uc6a9\ub418\uba70,<br \/>\n        \uc774\ub7ec\ud55c \ub204\uc801 \ud569 \ubc29\uc2dd\uc740 \ub370\uc774\ud130 \ubd84\uc11d, \ud1b5\uacc4 \ucc98\ub9ac \ub4f1 \uc5ec\ub7ec \ubd84\uc57c\uc5d0\uc11c \uc720\uc6a9\uc131\uc744 \ubcf4\uc5ec\uc90d\ub2c8\ub2e4.<br \/>\n        \uc774 \uac04\ub2e8\ud558\uc9c0\ub9cc \ub6f0\uc5b4\ub09c \ubc29\ubc95\uc744 \ud1b5\ud574 \ubb38\uc81c \ud574\uacb0\uc758 \ud6a8\uc728\uc131\uc744 \ub192\uc77c \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<p>        \uc774 \uac15\uc88c\uac00 \uc5ec\ub7ec\ubd84\uc758 C++ \ucf54\ub529 \ud14c\uc2a4\ud2b8 \uc900\ube44\uc5d0 \ub3c4\uc6c0\uc774 \ub418\uae38 \ubc14\ub78d\ub2c8\ub2e4!\n    <\/p>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ubb38\uc81c \uc8fc\uc5b4\uc9c4 \uc815\uc218 \ubc30\uc5f4 arr\uc640 \ub450 \uac1c\uc758 \uc815\uc218 left, right\uac00 \uc788\uc2b5\ub2c8\ub2e4. \uc774 \ub54c, arr[left] + arr[left + 1] + &#8230; + arr[right]\uc758 \uac12\uc744 \uacc4\uc0b0\ud558\ub294 \ud568\uc218\ub97c \uc791\uc131\ud558\uc2dc\uc624. \ub2e8, arr\ub294 1 \u2264 arr.length \u2264 100,000\uc758 \ubc94\uc704\ub97c \uac00\uc9c0\uba70, \uac01 \uc6d0\uc18c\ub294 -10^9 \u2264 arr[i] \u2264 10^9\uae4c\uc9c0\uc758 \ubc94\uc704\ub97c \uac00\uc9d1\ub2c8\ub2e4. \uc5ec\ub7ec\ubd84\uc740 O(log N) \ud639\uc740 O(1)\uc758 \uc2dc\uac04 \ubcf5\uc7a1\ub3c4\ub85c \uad6c\uac04 \ud569\uc744 \uad6c\ud560 \uc218 &hellip; <a href=\"https:\/\/atmokpo.com\/w\/27568\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \uad6c\uac04 \ud569 \uad6c\ud558\uae30 3&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[25],"tags":[],"class_list":["post-27568","post","type-post","status-publish","format-standard","hentry","category-c---2"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \uad6c\uac04 \ud569 \uad6c\ud558\uae30 3 - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8<\/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:\/\/atmokpo.com\/w\/27568\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \uad6c\uac04 \ud569 \uad6c\ud558\uae30 3 - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"\ubb38\uc81c \uc8fc\uc5b4\uc9c4 \uc815\uc218 \ubc30\uc5f4 arr\uc640 \ub450 \uac1c\uc758 \uc815\uc218 left, right\uac00 \uc788\uc2b5\ub2c8\ub2e4. \uc774 \ub54c, arr[left] + arr[left + 1] + ... + arr[right]\uc758 \uac12\uc744 \uacc4\uc0b0\ud558\ub294 \ud568\uc218\ub97c \uc791\uc131\ud558\uc2dc\uc624. \ub2e8, arr\ub294 1 \u2264 arr.length \u2264 100,000\uc758 \ubc94\uc704\ub97c \uac00\uc9c0\uba70, \uac01 \uc6d0\uc18c\ub294 -10^9 \u2264 arr[i] \u2264 10^9\uae4c\uc9c0\uc758 \ubc94\uc704\ub97c \uac00\uc9d1\ub2c8\ub2e4. \uc5ec\ub7ec\ubd84\uc740 O(log N) \ud639\uc740 O(1)\uc758 \uc2dc\uac04 \ubcf5\uc7a1\ub3c4\ub85c \uad6c\uac04 \ud569\uc744 \uad6c\ud560 \uc218 &hellip; \ub354 \ubcf4\uae30 &quot;C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \uad6c\uac04 \ud569 \uad6c\ud558\uae30 3&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/27568\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-10-27T14:41:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-26T07:17:13+00:00\" \/>\n<meta name=\"author\" content=\"root\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:site\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:label1\" content=\"\uae00\uc4f4\uc774\" \/>\n\t<meta name=\"twitter:data1\" content=\"root\" \/>\n\t<meta name=\"twitter:label2\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data2\" content=\"1\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/27568\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/27568\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \uad6c\uac04 \ud569 \uad6c\ud558\uae30 3\",\"datePublished\":\"2024-10-27T14:41:59+00:00\",\"dateModified\":\"2024-11-26T07:17:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/27568\/\"},\"wordCount\":14,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/27568\/\",\"url\":\"https:\/\/atmokpo.com\/w\/27568\/\",\"name\":\"C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \uad6c\uac04 \ud569 \uad6c\ud558\uae30 3 - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-10-27T14:41:59+00:00\",\"dateModified\":\"2024-11-26T07:17:13+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/27568\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/27568\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/27568\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \uad6c\uac04 \ud569 \uad6c\ud558\uae30 3\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/atmokpo.com\/w\/#website\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/atmokpo.com\/w\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"contentUrl\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"width\":400,\"height\":400,\"caption\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\"},\"image\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/bebubo4\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\",\"name\":\"root\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"caption\":\"root\"},\"sameAs\":[\"http:\/\/atmokpo.com\/w\"],\"url\":\"https:\/\/atmokpo.com\/w\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \uad6c\uac04 \ud569 \uad6c\ud558\uae30 3 - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","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:\/\/atmokpo.com\/w\/27568\/","og_locale":"ko_KR","og_type":"article","og_title":"C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \uad6c\uac04 \ud569 \uad6c\ud558\uae30 3 - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"\ubb38\uc81c \uc8fc\uc5b4\uc9c4 \uc815\uc218 \ubc30\uc5f4 arr\uc640 \ub450 \uac1c\uc758 \uc815\uc218 left, right\uac00 \uc788\uc2b5\ub2c8\ub2e4. \uc774 \ub54c, arr[left] + arr[left + 1] + ... + arr[right]\uc758 \uac12\uc744 \uacc4\uc0b0\ud558\ub294 \ud568\uc218\ub97c \uc791\uc131\ud558\uc2dc\uc624. \ub2e8, arr\ub294 1 \u2264 arr.length \u2264 100,000\uc758 \ubc94\uc704\ub97c \uac00\uc9c0\uba70, \uac01 \uc6d0\uc18c\ub294 -10^9 \u2264 arr[i] \u2264 10^9\uae4c\uc9c0\uc758 \ubc94\uc704\ub97c \uac00\uc9d1\ub2c8\ub2e4. \uc5ec\ub7ec\ubd84\uc740 O(log N) \ud639\uc740 O(1)\uc758 \uc2dc\uac04 \ubcf5\uc7a1\ub3c4\ub85c \uad6c\uac04 \ud569\uc744 \uad6c\ud560 \uc218 &hellip; \ub354 \ubcf4\uae30 \"C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \uad6c\uac04 \ud569 \uad6c\ud558\uae30 3\"","og_url":"https:\/\/atmokpo.com\/w\/27568\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-10-27T14:41:59+00:00","article_modified_time":"2024-11-26T07:17:13+00:00","author":"root","twitter_card":"summary_large_image","twitter_creator":"@bebubo4","twitter_site":"@bebubo4","twitter_misc":{"\uae00\uc4f4\uc774":"root","\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"1\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/27568\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/27568\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \uad6c\uac04 \ud569 \uad6c\ud558\uae30 3","datePublished":"2024-10-27T14:41:59+00:00","dateModified":"2024-11-26T07:17:13+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/27568\/"},"wordCount":14,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/27568\/","url":"https:\/\/atmokpo.com\/w\/27568\/","name":"C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \uad6c\uac04 \ud569 \uad6c\ud558\uae30 3 - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-10-27T14:41:59+00:00","dateModified":"2024-11-26T07:17:13+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/27568\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/27568\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/27568\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \uad6c\uac04 \ud569 \uad6c\ud558\uae30 3"}]},{"@type":"WebSite","@id":"https:\/\/atmokpo.com\/w\/#website","url":"https:\/\/atmokpo.com\/w\/","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","description":"","publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/atmokpo.com\/w\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/atmokpo.com\/w\/#organization","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","url":"https:\/\/atmokpo.com\/w\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/","url":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","contentUrl":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","width":400,"height":400,"caption":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8"},"image":{"@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/bebubo4"]},{"@type":"Person","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7","name":"root","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","caption":"root"},"sameAs":["http:\/\/atmokpo.com\/w"],"url":"https:\/\/atmokpo.com\/w\/author\/root\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/27568","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/comments?post=27568"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/27568\/revisions"}],"predecessor-version":[{"id":27569,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/27568\/revisions\/27569"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=27568"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=27568"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=27568"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}