{"id":8201,"date":"2008-10-13T12:38:00","date_gmt":"2008-10-13T12:38:00","guid":{"rendered":"http:\/\/melotopia.net\/b\/?p=8201"},"modified":"2008-10-13T12:38:00","modified_gmt":"2008-10-13T12:38:00","slug":"%ec%a0%95%ec%88%98-%eb%b6%84%ed%95%a0-%eb%ac%b8%ec%a0%9c","status":"publish","type":"post","link":"http:\/\/melotopia.net\/b\/?p=8201","title":{"rendered":"\uc815\uc218 \ubd84\ud560 \ubb38\uc81c"},"content":{"rendered":"<div class=\"desc\">\n        \uc0ac\uc2e4 \uc774\uac74 \ubb50\ub77c \ud558\uae30\ub3c4 \ud798\ub4e4\ub2e4.<br \/>\n        <br \/>\n        \ubb38\uc81c\ub97c \uc9c1\uc811 \ubcf4\uc790<br \/>\n        <br \/>\n        http:\/\/projecteuler.net\/index.php?section=problems&#038;id=207<br \/>\n        <br \/>\n        \uc774 \ube14\ub85c\uadf8 \uc5b4\ub518\uac00\uc5d0 \uc774 \ubb38\uc81c\uc5d0 \ub300\ud55c \uc0c1\uc138\ud55c \ud574\uc124\uc774 \uc801\ud600 \uc788\uc744 \uac83\uc774\ub2e4.<\/p>\n<p>        #include<stdio.h><br \/>\n        <br \/>\n        #include<stdlib.h><br \/>\n        <br \/>\n        #define YES 1<br \/>\n        <br \/>\n        #define NO 0<\/p>\n<p>        int isPowerOfTwo(int);<br \/>\n        <br \/>\n        int main(){<br \/>\n        <br \/>\n        int n=1;<br \/>\n        <br \/>\n        int q=0;<br \/>\n        <br \/>\n        int m;<br \/>\n        <br \/>\n        while(1){<br \/>\n        <br \/>\n        m=n*(n+1);<br \/>\n        <br \/>\n        if(isPowerOfTwo(n+1)==YES){<br \/>\n        <br \/>\n        q++;<br \/>\n        <br \/>\n        printf(&#8220;q=%u, n=%u, m=%u, p(m)=%lf\\n&#8221;,q,n, m, ((double)q\/(double)n));<br \/>\n        <br \/>\n        }<br \/>\n        <br \/>\n        if(((double)q\/(double)n)<1.0\/12345.0){\n        <br \/>\n        printf(&#8220;last, q=%u, n=%u, m=%u, p(m)=%lf\\n&#8221;,q,n, m, ((double)q\/(double)n));<br \/>\n        <br \/>\n        exit(0);<br \/>\n        <br \/>\n        }<br \/>\n        <br \/>\n        n++;<br \/>\n        <br \/>\n        }<br \/>\n        <br \/>\n        return 1;<br \/>\n        <br \/>\n        }<\/p>\n<p>        int isPowerOfTwo(int p){<br \/>\n        <br \/>\n        while(p-1){<br \/>\n        <br \/>\n        if(p%2!=0){<br \/>\n        <br \/>\n        return NO;<br \/>\n        <br \/>\n        }<br \/>\n        <br \/>\n        p=p\/2;<br \/>\n        <br \/>\n        }<br \/>\n        <br \/>\n        return YES;<br \/>\n        <br \/>\n        }<br \/>\n        <\/p>\n<div style=\"width:100%;margin-top:30px;clear:both;height:30px\">\n<div style=\"width:31px;float:left;\">\n<a href=\"\/toolbar\/popup\/abuseReport\/?entryId=1004\" onclick=\"window.open(this.href, 'tistoryThisBlogPopup', 'width=550, height=510, toolbar=no, menubar=no, status=no, scrollbars=no'); return false;\"><br \/>\n<img data-recalc-dims=\"1\" decoding=\"async\" alt=\"\uc2e0\uace0\" src=\"https:\/\/i0.wp.com\/t1.daumcdn.net\/tistory_admin\/static\/ico\/ico_spam_report.png\" style=\"border:0\"\/><br \/>\n<\/a>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\uc0ac\uc2e4 \uc774\uac74 \ubb50\ub77c \ud558\uae30\ub3c4 \ud798\ub4e4\ub2e4. \ubb38\uc81c\ub97c \uc9c1\uc811 \ubcf4\uc790 http:\/\/projecteuler.net\/index.php?section=problems&#038;id=207 \uc774 \ube14\ub85c\uadf8 \uc5b4\ub518\uac00\uc5d0 \uc774 \ubb38\uc81c\uc5d0 \ub300\ud55c \uc0c1\uc138\ud55c \ud574\uc124\uc774 \uc801\ud600 \uc788\uc744 \uac83\uc774\ub2e4. #include #include #define YES 1 #define NO 0 int isPowerOfTwo(int); int main(){ int n=1; int q=0; int m; while(1){ m=n*(n+1); if(isPowerOfTwo(n+1)==YES){ q++; printf(&#8220;q=%u, n=%u, m=%u, p(m)=%lf\\n&#8221;,q,n, m, ((double)q\/(double)n)); } if(((double)q\/(double)n)<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[2],"tags":[],"class_list":["post-8201","post","type-post","status-publish","format-standard","hentry","category-academic"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8o6gA-28h","jetpack-related-posts":[],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"http:\/\/melotopia.net\/b\/index.php?rest_route=\/wp\/v2\/posts\/8201","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/melotopia.net\/b\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/melotopia.net\/b\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/melotopia.net\/b\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/melotopia.net\/b\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8201"}],"version-history":[{"count":0,"href":"http:\/\/melotopia.net\/b\/index.php?rest_route=\/wp\/v2\/posts\/8201\/revisions"}],"wp:attachment":[{"href":"http:\/\/melotopia.net\/b\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/melotopia.net\/b\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8201"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/melotopia.net\/b\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}