{"id":88,"date":"2015-02-08T21:50:21","date_gmt":"2015-02-08T13:50:21","guid":{"rendered":"http:\/\/sqrt-1.me\/?p=88"},"modified":"2016-11-19T15:02:36","modified_gmt":"2016-11-19T07:02:36","slug":"%e4%bb%8e%e5%9b%be%e7%89%87%e7%9c%8b%e5%87%ba%e4%bc%aa%e9%9a%8f%e6%9c%ba%e6%95%b0%e7%9a%84%e5%91%a8%e6%9c%9f%e6%80%a7","status":"publish","type":"post","link":"https:\/\/sqrt-1.me\/?p=88","title":{"rendered":"\u4ece\u56fe\u7247\u770b\u51fa\u4f2a\u968f\u673a\u6570\u7684\u5468\u671f\u6027"},"content":{"rendered":"<p>\u4eca\u5929\u5c1d\u8bd5\u7528\u4ee3\u7801\u751f\u6210\u4e86\u4e00\u5f20\u5927\u5c0f\u4e3a1024*1024\uff0c\u6bcf\u4e2a\u50cf\u7d20\u7684RGB\u503c\u90fd\u662f\u968f\u673a\u6570\u7684\u56fe\u7247\uff08\u4ee5\u4e0b\u56fe\u7247\u7ecf\u8fc7\u4e86\u4e00\u5b9a\u7a0b\u5ea6\u7684\u538b\u7f29\uff09\uff1a<\/p>\n<p><a href=\"http:\/\/sqrt-1.me\/wp-content\/uploads\/2015\/02\/random1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-90\" src=\"http:\/\/sqrt-1.me\/wp-content\/uploads\/2015\/02\/random1.jpg\" alt=\"random1\" width=\"1024\" height=\"1024\" srcset=\"https:\/\/sqrt-1.me\/wp-content\/uploads\/2015\/02\/random1.jpg 1024w, https:\/\/sqrt-1.me\/wp-content\/uploads\/2015\/02\/random1-150x150.jpg 150w, https:\/\/sqrt-1.me\/wp-content\/uploads\/2015\/02\/random1-300x300.jpg 300w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/a><\/p>\n<p>\u672c\u5e94\u8be5\u662f\u5b8c\u5168\u968f\u673a\u7684\u56fe\u6848\uff0c\u4f46\u662f\u5728\u56fe\u7247\u4e2d\u5374\u53ef\u4ee5\u660e\u663e\u5730\u770b\u51fa\u8bb8\u591a\u7ad6\u7ebf\uff0c\u8fd9\u663e\u7136\u662f\u4f2a\u968f\u673a\u6570\u7684\u5468\u671f\u6027\u5bfc\u81f4\u7684\u3002<\/p>\n<p><!--more--><\/p>\n<p>\u7531\u4e8e\u56fe\u7247\u7684\u5bbd\u5ea6\u662f1024\u50cf\u7d20\uff0c\u6240\u4ee5\u6211\u731c\u6d4b\u5176\u4e2d\u7684\u5468\u671f\u4e00\u5b9a\u548c1024\u8fd9\u4e2a\u6570\u6709\u5173\u3002\u6211\u51b3\u5b9a\u770b\u4e00\u770b\u968f\u673a\u6570\u4ee51024\u4e3a\u5468\u671f\u7684\u7edf\u8ba1\u7279\u6027\u3002<\/p>\n<p>\u6211\u628a\u6bcf\u4e2a\u989c\u8272\u503c\u7684\u751f\u6210\u65b9\u6cd5\u6539\u4e3a\u8fde\u7eed\u83b7\u53d61024\u4e2a\u968f\u673a\u6570\uff0c\u7b97\u51fa\u603b\u548c\uff0c\u5e76\u5bf9256\u53d6\u4f59\u6570\uff0c\u5f97\u5230\u4e86\u8fd9\u5e45\u56fe\u7247\uff1a<\/p>\n<p><a href=\"http:\/\/sqrt-1.me\/wp-content\/uploads\/2015\/02\/random2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-92\" src=\"http:\/\/sqrt-1.me\/wp-content\/uploads\/2015\/02\/random2.jpg\" alt=\"random2\" width=\"1024\" height=\"1024\" srcset=\"https:\/\/sqrt-1.me\/wp-content\/uploads\/2015\/02\/random2.jpg 1024w, https:\/\/sqrt-1.me\/wp-content\/uploads\/2015\/02\/random2-150x150.jpg 150w, https:\/\/sqrt-1.me\/wp-content\/uploads\/2015\/02\/random2-300x300.jpg 300w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/a><\/p>\n<p>\u4ece\u8fd9\u5e45\u56fe\u7247\u4e2d\u53ef\u4ee5\u660e\u663e\u5730\u770b\u51fa\u5f88\u5f3a\u7684\u5468\u671f\u6027\uff01<\/p>\n<p>\u6211\u518d\u628a\u7edf\u8ba1\u7684\u5468\u671f\u53d6\u5927\u4e00\u4e9b\uff0c\u4f8b\u598232768\uff0c\u4ec5\u4ec5\u901a\u8fc7\u7b80\u5355\u7684\u8ba1\u7b97\u5c31\u53ef\u4ee5\u770b\u51fa\u968f\u673a\u6570\u5206\u5e03\u7684\u4e0d\u5747\u5300\u3002\u5199\u8fd9\u6837\u4e00\u6bb5C\u8bed\u8a00\u7a0b\u5e8f\uff1a<\/p>\n<pre class=\"lang:c decode:true \" >\r\n#include&lt;stdio.h&gt;\r\n#include&lt;stdlib.h&gt;\r\n#include&lt;time.h&gt;\r\n\r\nint main(){\r\n    unsigned int i,s,j;\r\n    srand(time(0));\r\n    for(i=0;i&lt;100;i++){\r\n        s=0;\r\n        for(j=0;j&lt;32768;j++){\r\n            s+=rand();\r\n        }\r\n        printf(&quot;%d&quot;,s%2);\r\n    }\r\n    return 0;\r\n}\r\n<\/pre>\n<p>\u8fd0\u884c\u7684\u7ed3\u679c\uff1a<\/p>\n<p>01010101010101010101010101010101\u2026\u2026<\/p>\n<p>\u6211\u53c8\u505a\u4e86\u4e00\u79cd\u5c1d\u8bd5\u2014\u2014\u5728\u4e00\u5f201024*1024\u7684\u9ed1\u8272\u80cc\u666f\u56fe\u7247\u4e0a\uff0c\u4ece\u5750\u6807\u4e3a(512,512)\u7684\u70b9\u5f00\u59cb\uff0c\u6bcf\u4e00\u6b21\u53d6\u968f\u673a\u6570\u9664\u4ee54\u7684\u4f59\u6570\uff0c\u5bf9\u5e94\u4e8e\u4e0a\u4e0b\u5de6\u53f3\u56db\u4e2a\u65b9\u5411\uff0c\u5728\u56fe\u7247\u4e0a\u968f\u673a\u884c\u8d70\uff0c\u7528\u6e10\u53d8\u7684\u989c\u8272\u753b\u51fa\u8f68\u8ff9\u3002<\/p>\n<p>\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre class=\"lang:c decode:true \" >\r\n#include &lt;stdio.h&gt;\r\n#include &lt;stdlib.h&gt;\r\n#include &lt;time.h&gt;\r\n#define DIM 1024\r\n\r\nint r[DIM][DIM],g[DIM][DIM],b[DIM][DIM];\r\nFILE *fp;\r\n\r\nvoid init(){\r\n    int R,G,B;\r\n    int x=DIM\/2,y=DIM\/2;\r\n    srand(time(0));\r\n    for(R=0;R&lt;256;R++)for(G=0;G&lt;256;G++)for(B=0;B&lt;256;B++){\r\n        r[x][y]=R;g[x][y]=G;b[x][y]=B;\r\n        switch(rand()&amp;3){\r\n            case 0:y--;break;\/\/up\r\n            case 1:x++;break;\/\/right\r\n            case 2:y++;break;\/\/down\r\n            case 3:x--;break;\/\/left\r\n        }\r\n        x&amp;=1023;\r\n        y&amp;=1023;\r\n    }\r\n}\r\n\r\nvoid pixel_write(int i, int j){\r\n    static unsigned char color[3];\r\n    color[0] = r[i][j]&amp;255;\r\n    color[1] = g[i][j]&amp;255;\r\n    color[2] = b[i][j]&amp;255;\r\n    fwrite(color, 1, 3, fp);\r\n}\r\n\r\nint main(){\r\n    init();\r\n    fp = fopen(&quot;Pic.ppm&quot;,&quot;wb&quot;);\r\n    fprintf(fp, &quot;P6\\n%d %d\\n255\\n&quot;, DIM, DIM);\r\n    for(int j=0;j&lt;DIM;j++)\r\n        for(int i=0;i&lt;DIM;i++)\r\n            pixel_write(i,j);\r\n    fclose(fp);\r\n    return 0;\r\n}\r\n<\/pre>\n<p>\u8fd0\u884c\u7ed3\u679c\uff1a<\/p>\n<p><a href=\"http:\/\/sqrt-1.me\/wp-content\/uploads\/2015\/02\/random3.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-98\" src=\"http:\/\/sqrt-1.me\/wp-content\/uploads\/2015\/02\/random3.jpg\" alt=\"random3\" width=\"1024\" height=\"1024\" srcset=\"https:\/\/sqrt-1.me\/wp-content\/uploads\/2015\/02\/random3.jpg 1024w, https:\/\/sqrt-1.me\/wp-content\/uploads\/2015\/02\/random3-150x150.jpg 150w, https:\/\/sqrt-1.me\/wp-content\/uploads\/2015\/02\/random3-300x300.jpg 300w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/a><\/p>\n<p>\u53ef\u4ee5\u770b\u51fa\u6574\u5f20\u56fe\u7247\u53ea\u6709\u4e00\u5c0f\u90e8\u5206\u88ab\u989c\u8272\u8986\u76d6\u4e86\uff0c\u800c\u4e14\u56fe\u6848\u7684\u5bf9\u79f0\u6027\u5f88\u5f3a\u3002<\/p>\n<p>\u8fd9\u4e9b\u4ee3\u7801\u662f\u5728Windows\u4e0a\u7528Dev-C++\u4e2d\u7684GCC\u7f16\u8bd1\u5668\u7f16\u8bd1\u7684\uff0c\u5982\u679c\u6362\u4e00\u79cd\u73af\u5883\uff0c\u968f\u673a\u6570\u7684\u5468\u671f\u6027\u8fd8\u4f1a\u8fd9\u4e48\u5f3a\u5417\uff1f<\/p>\n<p>\u6211\u53c8\u8bd5\u4e86Visual Studio 2012\uff0c\u6548\u679c\u548c\u4e4b\u524d\u5b8c\u5168\u4e00\u6837\u3002<\/p>\n<p>\u4f46\u662f\u5f53\u6211\u5728Ubuntu\u4e0a\u4f7f\u7528GCC\u7f16\u8bd1\u65f6\uff0c\u60c5\u51b5\u53d1\u751f\u4e86\u53d8\u5316\u3002<\/p>\n<p>\u9996\u5148\u6211\u7f16\u8bd1\u8fd0\u884c\u4e86\u90a3\u6bb5\u5f88\u77ed\u7684C\u8bed\u8a00\u4ee3\u7801\uff0c\u7a0b\u5e8f\u7ed9\u51fa\u7684\u7ed3\u679c\u4e2d\u627e\u4e0d\u5230\u89c4\u5f8b\u3002\u6211\u53c8\u8fd0\u884c\u4e86\u968f\u673a\u884c\u8d70\u7684\u4ee3\u7801\uff0c\u6548\u679c\u5982\u4e0b\uff1a<\/p>\n<p><a href=\"http:\/\/sqrt-1.me\/wp-content\/uploads\/2015\/02\/random4.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-99\" src=\"http:\/\/sqrt-1.me\/wp-content\/uploads\/2015\/02\/random4.jpg\" alt=\"random4\" width=\"1024\" height=\"1024\" srcset=\"https:\/\/sqrt-1.me\/wp-content\/uploads\/2015\/02\/random4.jpg 1024w, https:\/\/sqrt-1.me\/wp-content\/uploads\/2015\/02\/random4-150x150.jpg 150w, https:\/\/sqrt-1.me\/wp-content\/uploads\/2015\/02\/random4-300x300.jpg 300w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/a><\/p>\n<p>\u53ef\u4ee5\u770b\u51fa\u989c\u8272\u968f\u673a\u8986\u76d6\u4e86\u51e0\u4e4e\u6574\u4e2a\u5c4f\u5e55\uff0c\u6beb\u65e0\u89c4\u5f8b\u53ef\u5faa\u3002\u8fd9\u8bf4\u660eUbuntu\u4e0b\u7684GCC\u7f16\u8bd1\u5668\u4f7f\u7528\u7684\u968f\u673a\u6570\u7b97\u6cd5\u6bd4Windows\u4e0b\u7684\u8981\u597d\u3002<\/p>\n<p>\u7528\u968f\u673a\u989c\u8272\u751f\u6210\u7684\u968f\u673a\u56fe\u6848\u8fd8\u662f\u5f88\u7f8e\u7684\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u5929\u5c1d\u8bd5\u7528\u4ee3\u7801\u751f\u6210\u4e86\u4e00\u5f20\u5927\u5c0f\u4e3a1024*1024\uff0c\u6bcf\u4e2a\u50cf\u7d20\u7684RGB\u503c\u90fd\u662f\u968f\u673a\u6570\u7684\u56fe\u7247\uff08\u4ee5\u4e0b\u56fe\u7247\u7ecf\u8fc7\u4e86\u4e00\u5b9a\u7a0b\u5ea6\u7684 &hellip; <a href=\"https:\/\/sqrt-1.me\/?p=88\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201c\u4ece\u56fe\u7247\u770b\u51fa\u4f2a\u968f\u673a\u6570\u7684\u5468\u671f\u6027\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":"","_links_to":"","_links_to_target":""},"categories":[2],"tags":[],"class_list":["post-88","post","type-post","status-publish","format-standard","hentry","category-c-language"],"_links":{"self":[{"href":"https:\/\/sqrt-1.me\/index.php?rest_route=\/wp\/v2\/posts\/88","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sqrt-1.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sqrt-1.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sqrt-1.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sqrt-1.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=88"}],"version-history":[{"count":12,"href":"https:\/\/sqrt-1.me\/index.php?rest_route=\/wp\/v2\/posts\/88\/revisions"}],"predecessor-version":[{"id":349,"href":"https:\/\/sqrt-1.me\/index.php?rest_route=\/wp\/v2\/posts\/88\/revisions\/349"}],"wp:attachment":[{"href":"https:\/\/sqrt-1.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=88"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sqrt-1.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=88"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sqrt-1.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=88"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}