<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-890102498135123039</id><updated>2011-04-22T06:55:36.583+08:00</updated><category term='Project Euler'/><category term='programme'/><category term='Linux(Ubuntu)'/><category term='随思杂想'/><title type='text'>DCY's Notes</title><subtitle type='html'>不用别人认可也不用别人理解，尽情去做自己认为应该做的事……</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://dengcaiyun.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://dengcaiyun.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>dengcaiyun</name><uri>http://www.blogger.com/profile/13995124280643652348</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>18</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-890102498135123039.post-1824610454592527929</id><published>2009-05-14T01:08:00.001+08:00</published><updated>2009-05-14T01:10:29.164+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='随思杂想'/><title type='text'>时间……</title><content type='html'>发觉自己一只在浪费时间，一直在挥霍……&lt;br /&gt;我应该要珍惜的，加油吧！&lt;br /&gt;别再给自己找借口和理由&lt;br /&gt;还记得高中班主任田春霞那句“不为失败找理由，要为成功想办法”&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/890102498135123039-1824610454592527929?l=dengcaiyun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dengcaiyun.blogspot.com/feeds/1824610454592527929/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=890102498135123039&amp;postID=1824610454592527929&amp;isPopup=true' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/1824610454592527929'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/1824610454592527929'/><link rel='alternate' type='text/html' href='http://dengcaiyun.blogspot.com/2009/05/blog-post_14.html' title='时间……'/><author><name>dengcaiyun</name><uri>http://www.blogger.com/profile/13995124280643652348</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-890102498135123039.post-6009617404469070038</id><published>2009-05-10T13:22:00.002+08:00</published><updated>2009-05-10T13:26:51.698+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='随思杂想'/><title type='text'>一段话……</title><content type='html'>今天看了《我的青春谁做主》，里面某人的姥姥讲了一段很好的话：其实不是所有得到的结果都是成功，也不是没有结果的就是失败，成功藏在过程里，将来回头看，乐趣肯定不在撞线的那一下，结果就像是买东西的赠品，有了算白赚，没有也没什么……&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/890102498135123039-6009617404469070038?l=dengcaiyun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dengcaiyun.blogspot.com/feeds/6009617404469070038/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=890102498135123039&amp;postID=6009617404469070038&amp;isPopup=true' title='1 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/6009617404469070038'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/6009617404469070038'/><link rel='alternate' type='text/html' href='http://dengcaiyun.blogspot.com/2009/05/blog-post_10.html' title='一段话……'/><author><name>dengcaiyun</name><uri>http://www.blogger.com/profile/13995124280643652348</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-890102498135123039.post-7490663127289989434</id><published>2009-05-06T21:02:00.000+08:00</published><updated>2009-05-06T21:07:51.795+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Problem 14--(c)</title><content type='html'>Problem 14&lt;br /&gt;05 April 2002&lt;br /&gt;&lt;br /&gt;The following iterative sequence is defined for the set of positive integers:&lt;br /&gt;&lt;br /&gt;n → n/2 (n is even)&lt;br /&gt;n → 3n + 1 (n is odd)&lt;br /&gt;&lt;br /&gt;Using the rule above and starting with 13, we generate the following sequence:&lt;br /&gt;13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1&lt;br /&gt;&lt;br /&gt;It can be seen that this sequence (starting at 13 and finishing at 1) contains 10 terms. Although it has not been proved yet (Collatz Problem), it is thought that all starting numbers finish at 1.&lt;br /&gt;&lt;br /&gt;Which starting number, under one million, produces the longest chain?&lt;br /&gt;&lt;br /&gt;NOTE: Once the chain starts the terms are allowed to go above one million.&lt;br /&gt;&lt;br /&gt;Answer:&lt;br /&gt; 837799&lt;br /&gt;code:&lt;br /&gt;#include&lt;stdio.h&gt;&lt;br /&gt;int main(void)&lt;br /&gt;{&lt;br /&gt;    long int num,max=0,i,j,answer;&lt;br /&gt;    for(i=2;i&lt;1000000;i++)&lt;br /&gt;    {&lt;br /&gt;        j=i;&lt;br /&gt;        num=0;&lt;br /&gt;        while(j!=1)&lt;br /&gt;        {&lt;br /&gt;            if(j%2==0) {j=j/2;num++;}&lt;br /&gt;            else {j=3*j+1;num++;}&lt;br /&gt;        }&lt;br /&gt;        if(num&gt;max) {max=num;answer=i;}&lt;br /&gt;    }&lt;br /&gt;    printf("%ld\n",answer);&lt;br /&gt;    return 0;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/890102498135123039-7490663127289989434?l=dengcaiyun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dengcaiyun.blogspot.com/feeds/7490663127289989434/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=890102498135123039&amp;postID=7490663127289989434&amp;isPopup=true' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/7490663127289989434'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/7490663127289989434'/><link rel='alternate' type='text/html' href='http://dengcaiyun.blogspot.com/2009/05/problem-14-c.html' title='Problem 14--(c)'/><author><name>dengcaiyun</name><uri>http://www.blogger.com/profile/13995124280643652348</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-890102498135123039.post-1694155668408293536</id><published>2009-05-06T21:01:00.000+08:00</published><updated>2009-05-06T21:02:25.440+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Problem 13--(c)</title><content type='html'>Problem 13&lt;br /&gt;22 March 2002&lt;br /&gt;&lt;br /&gt;Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.&lt;br /&gt;37107287533902102798797998220837590246510135740250&lt;br /&gt;46376937677490009712648124896970078050417018260538&lt;br /&gt;74324986199524741059474233309513058123726617309629&lt;br /&gt;91942213363574161572522430563301811072406154908250&lt;br /&gt;23067588207539346171171980310421047513778063246676&lt;br /&gt;89261670696623633820136378418383684178734361726757&lt;br /&gt;28112879812849979408065481931592621691275889832738&lt;br /&gt;44274228917432520321923589422876796487670272189318&lt;br /&gt;47451445736001306439091167216856844588711603153276&lt;br /&gt;70386486105843025439939619828917593665686757934951&lt;br /&gt;62176457141856560629502157223196586755079324193331&lt;br /&gt;64906352462741904929101432445813822663347944758178&lt;br /&gt;92575867718337217661963751590579239728245598838407&lt;br /&gt;58203565325359399008402633568948830189458628227828&lt;br /&gt;80181199384826282014278194139940567587151170094390&lt;br /&gt;35398664372827112653829987240784473053190104293586&lt;br /&gt;86515506006295864861532075273371959191420517255829&lt;br /&gt;71693888707715466499115593487603532921714970056938&lt;br /&gt;54370070576826684624621495650076471787294438377604&lt;br /&gt;53282654108756828443191190634694037855217779295145&lt;br /&gt;36123272525000296071075082563815656710885258350721&lt;br /&gt;45876576172410976447339110607218265236877223636045&lt;br /&gt;17423706905851860660448207621209813287860733969412&lt;br /&gt;81142660418086830619328460811191061556940512689692&lt;br /&gt;51934325451728388641918047049293215058642563049483&lt;br /&gt;62467221648435076201727918039944693004732956340691&lt;br /&gt;15732444386908125794514089057706229429197107928209&lt;br /&gt;55037687525678773091862540744969844508330393682126&lt;br /&gt;18336384825330154686196124348767681297534375946515&lt;br /&gt;80386287592878490201521685554828717201219257766954&lt;br /&gt;78182833757993103614740356856449095527097864797581&lt;br /&gt;16726320100436897842553539920931837441497806860984&lt;br /&gt;48403098129077791799088218795327364475675590848030&lt;br /&gt;87086987551392711854517078544161852424320693150332&lt;br /&gt;59959406895756536782107074926966537676326235447210&lt;br /&gt;69793950679652694742597709739166693763042633987085&lt;br /&gt;41052684708299085211399427365734116182760315001271&lt;br /&gt;65378607361501080857009149939512557028198746004375&lt;br /&gt;35829035317434717326932123578154982629742552737307&lt;br /&gt;94953759765105305946966067683156574377167401875275&lt;br /&gt;88902802571733229619176668713819931811048770190271&lt;br /&gt;25267680276078003013678680992525463401061632866526&lt;br /&gt;36270218540497705585629946580636237993140746255962&lt;br /&gt;24074486908231174977792365466257246923322810917141&lt;br /&gt;91430288197103288597806669760892938638285025333403&lt;br /&gt;34413065578016127815921815005561868836468420090470&lt;br /&gt;23053081172816430487623791969842487255036638784583&lt;br /&gt;11487696932154902810424020138335124462181441773470&lt;br /&gt;63783299490636259666498587618221225225512486764533&lt;br /&gt;67720186971698544312419572409913959008952310058822&lt;br /&gt;95548255300263520781532296796249481641953868218774&lt;br /&gt;76085327132285723110424803456124867697064507995236&lt;br /&gt;37774242535411291684276865538926205024910326572967&lt;br /&gt;23701913275725675285653248258265463092207058596522&lt;br /&gt;29798860272258331913126375147341994889534765745501&lt;br /&gt;18495701454879288984856827726077713721403798879715&lt;br /&gt;38298203783031473527721580348144513491373226651381&lt;br /&gt;34829543829199918180278916522431027392251122869539&lt;br /&gt;40957953066405232632538044100059654939159879593635&lt;br /&gt;29746152185502371307642255121183693803580388584903&lt;br /&gt;41698116222072977186158236678424689157993532961922&lt;br /&gt;62467957194401269043877107275048102390895523597457&lt;br /&gt;23189706772547915061505504953922979530901129967519&lt;br /&gt;86188088225875314529584099251203829009407770775672&lt;br /&gt;11306739708304724483816533873502340845647058077308&lt;br /&gt;82959174767140363198008187129011875491310547126581&lt;br /&gt;97623331044818386269515456334926366572897563400500&lt;br /&gt;42846280183517070527831839425882145521227251250327&lt;br /&gt;55121603546981200581762165212827652751691296897789&lt;br /&gt;32238195734329339946437501907836945765883352399886&lt;br /&gt;75506164965184775180738168837861091527357929701337&lt;br /&gt;62177842752192623401942399639168044983993173312731&lt;br /&gt;32924185707147349566916674687634660915035914677504&lt;br /&gt;99518671430235219628894890102423325116913619626622&lt;br /&gt;73267460800591547471830798392868535206946944540724&lt;br /&gt;76841822524674417161514036427982273348055556214818&lt;br /&gt;97142617910342598647204516893989422179826088076852&lt;br /&gt;87783646182799346313767754307809363333018982642090&lt;br /&gt;10848802521674670883215120185883543223812876952786&lt;br /&gt;71329612474782464538636993009049310363619763878039&lt;br /&gt;62184073572399794223406235393808339651327408011116&lt;br /&gt;66627891981488087797941876876144230030984490851411&lt;br /&gt;60661826293682836764744779239180335110989069790714&lt;br /&gt;85786944089552990653640447425576083659976645795096&lt;br /&gt;66024396409905389607120198219976047599490197230297&lt;br /&gt;64913982680032973156037120041377903785566085089252&lt;br /&gt;16730939319872750275468906903707539413042652315011&lt;br /&gt;94809377245048795150954100921645863754710598436791&lt;br /&gt;78639167021187492431995700641917969777599028300699&lt;br /&gt;15368713711936614952811305876380278410754449733078&lt;br /&gt;40789923115535562561142322423255033685442488917353&lt;br /&gt;44889911501440648020369068063960672322193204149535&lt;br /&gt;41503128880339536053299340368006977710650566631954&lt;br /&gt;81234880673210146739058568557934581403627822703280&lt;br /&gt;82616570773948327592232845941706525094512325230608&lt;br /&gt;22918802058777319719839450180888072429661980811197&lt;br /&gt;77158542502016545090413245809786882778948721859617&lt;br /&gt;72107838435069186155435662884062257473692284509516&lt;br /&gt;20849603980134001723930671666823555245252804609722&lt;br /&gt;53503534226472524250874054075591789781264330331690&lt;br /&gt;&lt;br /&gt;Answer:&lt;br /&gt; 5537376230&lt;br /&gt;code:&lt;br /&gt;#include&lt;stdio.h&gt;&lt;br /&gt;int main(void)&lt;br /&gt;{&lt;br /&gt;    long long int i,j,num,sum=0;&lt;br /&gt;    long long int a[100][5]={&lt;br /&gt;    3710728753,3902102798,7979982208,3759024651,0135740250,&lt;br /&gt;            4637693767,7490009712,6481248969,7007805041,7018260538,&lt;br /&gt;            7432498619,9524741059,4742333095,1305812372,6617309629,&lt;br /&gt;            9194221336,3574161572,5224305633,181107240,6154908250,&lt;br /&gt;            2306758820,7539346171,1719803104,2104751377,8063246676,&lt;br /&gt;            8926167069,6623633820,1363784183,8368417873,4361726757,&lt;br /&gt;            2811287981,2849979408,654819315,9262169127,5889832738,&lt;br /&gt;            4427422891,7432520321,9235894228,7679648767,272189318,&lt;br /&gt;            4745144573,6001306439,911672168,5684458871,1603153276,&lt;br /&gt;            7038648610,5843025439,9396198289,1759366568,6757934951,&lt;br /&gt;            6217645714,1856560629,5021572231,9658675507,9324193331,&lt;br /&gt;            6490635246,2741904929,1014324458,1382266334,7944758178,&lt;br /&gt;            9257586771,8337217661,9637515905,7923972824,5598838407,&lt;br /&gt;            5820356532,5359399008,4026335689,4883018945,8628227828,&lt;br /&gt;            8018119938,4826282014,2781941399,4056758715,1170094390,&lt;br /&gt;            3539866437,2827112653,8299872407,8447305319,104293586,&lt;br /&gt;            8651550600,6295864861,5320752733,7195919142,517255829,&lt;br /&gt;            7169388870,7715466499,1155934876,353292171,4970056938,&lt;br /&gt;            5437007057,6826684624,6214956500,7647178729,4438377604,&lt;br /&gt;            5328265410,8756828443,1911906346,9403785521,7779295145,&lt;br /&gt;            3612327252,5000296071,750825638,1565671088,5258350721,&lt;br /&gt;            4587657617,2410976447,3391106072,1826523687,7223636045,&lt;br /&gt;            1742370690,5851860660,4482076212,981328786,733969412,&lt;br /&gt;            8114266041,8086830619,3284608111,9106155694,512689692,&lt;br /&gt;            5193432545,1728388641,9180470492,9321505864,2563049483,&lt;br /&gt;            6246722164,8435076201,7279180399,4469300473,2956340691,&lt;br /&gt;            1573244438,6908125794,5140890577,622942919,7107928209,&lt;br /&gt;            5503768752,5678773091,8625407449,6984450833,393682126,&lt;br /&gt;            1833638482,5330154686,1961243487,6768129753,4375946515,&lt;br /&gt;            8038628759,2878490201,5216855548,2871720121,9257766954,&lt;br /&gt;            7818283375,7993103614,7403568564,4909552709,7864797581,&lt;br /&gt;            1672632010,436897842,5535399209,3183744149,7806860984,&lt;br /&gt;            4840309812,9077791799,882187953,2736447567,5590848030,&lt;br /&gt;            8708698755,1392711854,5170785441,6185242432,693150332,&lt;br /&gt;            5995940689,5756536782,1070749269,6653767632,6235447210,&lt;br /&gt;            6979395067,9652694742,5977097391,6669376304,2633987085,&lt;br /&gt;            4105268470,8299085211,3994273657,3411618276,0315001271,&lt;br /&gt;            6537860736,1501080857,91499395,1255702819,8746004375,&lt;br /&gt;            3582903531,7434717326,9321235781,5498262974,2552737307,&lt;br /&gt;            9495375976,5105305946,9660676831,5657437716,7401875275,&lt;br /&gt;            8890280257,1733229619,1766687138,1993181104,8770190271,&lt;br /&gt;            2526768027,6078003013,6786809925,2546340106,1632866526,&lt;br /&gt;            3627021854,497705585,6299465806,3623799314,746255962,&lt;br /&gt;            2407448690,8231174977,7923654662,5724692332,2810917141,&lt;br /&gt;            9143028819,7103288597,8066697608,9293863828,5025333403,&lt;br /&gt;            3441306557,8016127815,9218150055,6186883646,8420090470,&lt;br /&gt;            2305308117,2816430487,6237919698,4248725503,6638784583,&lt;br /&gt;            1148769693,2154902810,4240201383,3512446218,1441773470,&lt;br /&gt;            6378329949,636259666,4985876182,2122522551,2486764533,&lt;br /&gt;            6772018697,1698544312,4195724099,1395900895,2310058822,&lt;br /&gt;            9554825530,263520781,5322967962,4948164195,3868218774,&lt;br /&gt;            7608532713,2285723110,4248034561,2486769706,4507995236,&lt;br /&gt;            3777424253,5411291684,2768655389,2620502491,326572967,&lt;br /&gt;            2370191327,5725675285,6532482582,6546309220,7058596522,&lt;br /&gt;            2979886027,2258331913,1263751473,4199488953,4765745501,&lt;br /&gt;            1849570145,4879288984,8568277260,7771372140,3798879715,&lt;br /&gt;            3829820378,3031473527,7215803481,4451349137,3226651381,&lt;br /&gt;            3482954382,9199918180,2789165224,3102739225,1122869539,&lt;br /&gt;            4095795306,6405232632,5380441000,5965493915,9879593635,&lt;br /&gt;            2974615218,5502371307,6422551211,8369380358,388584903,&lt;br /&gt;            4169811622,2072977186,1582366784,2468915799,3532961922,&lt;br /&gt;            6246795719,4401269043,8771072750,4810239089,5523597457,&lt;br /&gt;            2318970677,2547915061,5055049539,2297953090,1129967519,&lt;br /&gt;            8618808822,5875314529,5840992512,382900940,7770775672,&lt;br /&gt;            1130673970,8304724483,8165338735,234084564,7058077308,&lt;br /&gt;            8295917476,7140363198,81871290,1187549131,547126581,&lt;br /&gt;            9762333104,4818386269,5154563349,2636657289,7563400500,&lt;br /&gt;            4284628018,3517070527,8318394258,8214552122,7251250327,&lt;br /&gt;            5512160354,6981200581,7621652128,2765275169,1296897789,&lt;br /&gt;            3223819573,4329339946,4375019078,3694576588,3352399886,&lt;br /&gt;            7550616496,5184775180,7381688378,6109152735,7929701337,&lt;br /&gt;            6217784275,2192623401,9423996391,6804498399,3173312731,&lt;br /&gt;            3292418570,7147349566,9166746876,3466091503,5914677504,&lt;br /&gt;            9951867143,235219628,8948901024,2332511691,3619626622,&lt;br /&gt;            7326746080,591547471,8307983928,6853520694,6944540724,&lt;br /&gt;            7684182252,4674417161,5140364279,8227334805,5556214818,&lt;br /&gt;            9714261791,342598647,2045168939,8942217982,6088076852,&lt;br /&gt;            8778364618,2799346313,7677543078,936333301,8982642090,&lt;br /&gt;            1084880252,1674670883,2151201858,8354322381,2876952786,&lt;br /&gt;            7132961247,4782464538,6369930090,4931036361,9763878039,&lt;br /&gt;            6218407357,2399794223,4062353938,833965132,7408011116,&lt;br /&gt;            6662789198,1488087797,9418768761,4423003098,4490851411,&lt;br /&gt;            6066182629,3682836764,7447792391,8033511098,9069790714,&lt;br /&gt;            8578694408,9552990653,6404474255,7608365997,6645795096,&lt;br /&gt;            6602439640,9905389607,1201982199,7604759949,197230297,&lt;br /&gt;            6491398268,32973156,0371200413,7790378556,6085089252,&lt;br /&gt;            1673093931,9872750275,4689069037,753941304,2652315011,&lt;br /&gt;            9480937724,5048795150,9541009216,4586375471,598436791,&lt;br /&gt;            7863916702,1187492431,9957006419,1796977759,9028300699,&lt;br /&gt;            1536871371,1936614952,8113058763,8027841075,4449733078,&lt;br /&gt;            4078992311,5535562561,1423224232,5503368544,2488917353,&lt;br /&gt;            4488991150,1440648020,3690680639,6067232219,3204149535,&lt;br /&gt;            4150312888,339536053,2993403680,697771065,566631954,&lt;br /&gt;            8123488067,3210146739,585685579,3458140362,7822703280,&lt;br /&gt;            8261657077,3948327592,2328459417,652509451,2325230608,&lt;br /&gt;            2291880205,8777319719,8394501808,8807242966,1980811197,&lt;br /&gt;            7715854250,2016545090,4132458097,8688277894,8721859617,&lt;br /&gt;            7210783843,5069186155,4356628840,6225747369,2284509516,&lt;br /&gt;            2084960398,0134001723,9306716668,2355524525,2804609722,&lt;br /&gt;            5350353422,6472524250,8740540755,9178978126,4330331690};&lt;br /&gt;    for(j=4;j&gt;=0;j--)&lt;br /&gt;    {&lt;br /&gt;        sum=0;&lt;br /&gt;        for(i=0;i&lt;=99;i++)&lt;br /&gt;          sum+=a[i][j];&lt;br /&gt;        sum+=num;&lt;br /&gt;        num=sum/10000000000;&lt;br /&gt;    }&lt;br /&gt;    printf("%lld\n",sum);&lt;br /&gt;    return 0;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/890102498135123039-1694155668408293536?l=dengcaiyun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dengcaiyun.blogspot.com/feeds/1694155668408293536/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=890102498135123039&amp;postID=1694155668408293536&amp;isPopup=true' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/1694155668408293536'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/1694155668408293536'/><link rel='alternate' type='text/html' href='http://dengcaiyun.blogspot.com/2009/05/problem-13-c.html' title='Problem 13--(c)'/><author><name>dengcaiyun</name><uri>http://www.blogger.com/profile/13995124280643652348</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-890102498135123039.post-8425010327861192789</id><published>2009-05-06T20:56:00.000+08:00</published><updated>2009-05-06T21:00:32.306+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Problem 12--(c)</title><content type='html'>&lt;span style="font-style:italic;"&gt;Problem 12&lt;br /&gt;08 March 2002&lt;br /&gt;&lt;br /&gt;The sequence of triangle numbers is generated by adding the natural numbers. So the 7^(th) triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be:&lt;br /&gt;&lt;br /&gt;1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...&lt;br /&gt;&lt;br /&gt;Let us list the factors of the first seven triangle numbers:&lt;br /&gt;&lt;br /&gt;     1: 1&lt;br /&gt;     3: 1,3&lt;br /&gt;     6: 1,2,3,6&lt;br /&gt;    10: 1,2,5,10&lt;br /&gt;    15: 1,3,5,15&lt;br /&gt;    21: 1,3,7,21&lt;br /&gt;    28: 1,2,4,7,14,28&lt;br /&gt;&lt;br /&gt;We can see that 28 is the first triangle number to have over five divisors.&lt;br /&gt;&lt;br /&gt;What is the value of the first triangle number to have over five hundred divisors?&lt;br /&gt;&lt;br /&gt;Answer:&lt;br /&gt;	76576500&lt;br /&gt;code:&lt;br /&gt;#include&lt;stdio.h&gt;&lt;br /&gt;#include&lt;math.h&gt;&lt;br /&gt;int main(void)&lt;br /&gt;{&lt;br /&gt;    long int result=0;&lt;br /&gt;    long int i=1;&lt;br /&gt;    int counter=0;&lt;br /&gt;    while(counter&lt;=500)&lt;br /&gt;    {&lt;br /&gt;        result+=i;&lt;br /&gt;        i++;&lt;br /&gt;        counter=0;&lt;br /&gt;        long int j;&lt;br /&gt;        long int k=sqrt(result);&lt;br /&gt;        for(j=1;j&lt;k;j++)&lt;br /&gt;        {&lt;br /&gt;            if(result%j==0)&lt;br /&gt;            {&lt;br /&gt;                counter+=2;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        if(result==k*k) counter++;&lt;br /&gt;    }&lt;br /&gt;    printf("%ld\n",result);&lt;br /&gt;    return 0;&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/890102498135123039-8425010327861192789?l=dengcaiyun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dengcaiyun.blogspot.com/feeds/8425010327861192789/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=890102498135123039&amp;postID=8425010327861192789&amp;isPopup=true' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/8425010327861192789'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/8425010327861192789'/><link rel='alternate' type='text/html' href='http://dengcaiyun.blogspot.com/2009/05/problem-12-c.html' title='Problem 12--(c)'/><author><name>dengcaiyun</name><uri>http://www.blogger.com/profile/13995124280643652348</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-890102498135123039.post-1842554020335545178</id><published>2009-05-06T20:55:00.001+08:00</published><updated>2009-05-12T12:05:11.871+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Problem 11</title><content type='html'>Problem 11&lt;br /&gt;22 February 2002&lt;br /&gt;&lt;br /&gt;In the 20×20 grid below, four numbers along a diagonal line have been marked in red.&lt;br /&gt;&lt;br /&gt;08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08&lt;br /&gt;49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00&lt;br /&gt;81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65&lt;br /&gt;52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91&lt;br /&gt;22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80&lt;br /&gt;24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50&lt;br /&gt;32 98 81 28 64 23 67 10 26 38 40 67 59 54 70 66 18 38 64 70&lt;br /&gt;67 26 20 68 02 62 12 20 95 63 94 39 63 08 40 91 66 49 94 21&lt;br /&gt;24 55 58 05 66 73 99 26 97 17 78 78 96 83 14 88 34 89 63 72&lt;br /&gt;21 36 23 09 75 00 76 44 20 45 35 14 00 61 33 97 34 31 33 95&lt;br /&gt;78 17 53 28 22 75 31 67 15 94 03 80 04 62 16 14 09 53 56 92&lt;br /&gt;16 39 05 42 96 35 31 47 55 58 88 24 00 17 54 24 36 29 85 57&lt;br /&gt;86 56 00 48 35 71 89 07 05 44 44 37 44 60 21 58 51 54 17 58&lt;br /&gt;19 80 81 68 05 94 47 69 28 73 92 13 86 52 17 77 04 89 55 40&lt;br /&gt;04 52 08 83 97 35 99 16 07 97 57 32 16 26 26 79 33 27 98 66&lt;br /&gt;88 36 68 87 57 62 20 72 03 46 33 67 46 55 12 32 63 93 53 69&lt;br /&gt;04 42 16 73 38 25 39 11 24 94 72 18 08 46 29 32 40 62 76 36&lt;br /&gt;20 69 36 41 72 30 23 88 34 62 99 69 82 67 59 85 74 04 36 16&lt;br /&gt;20 73 35 29 78 31 90 01 74 31 49 71 48 86 81 16 23 57 05 54&lt;br /&gt;01 70 54 71 83 51 54 69 16 92 33 48 61 43 52 01 89 19 67 48&lt;br /&gt;&lt;br /&gt;The product of these numbers is 26 × 63 × 78 × 14 = 1788696.&lt;br /&gt;&lt;br /&gt;What is the greatest product of four adjacent numbers in any direction (up, down, left, right, or diagonally) in the 20×20 grid?&lt;br /&gt;&lt;br /&gt;Answer:&lt;br /&gt; 70600674&lt;br /&gt;code:&lt;br /&gt;#include&lt;stdio.h&gt;&lt;br /&gt;int main(void)&lt;br /&gt;{&lt;br /&gt;    int a[20][20]={8,02,22,97,38,15,00,40,00,75,04,05,07,78,52,12,50,77,91,8,49,49,99,40,17,81,18,57,60,87,17,40,98,43,69,48,04,56,62,00,81,49,31,73,55,79,14,29,93,71,40,67,53,88,30,03,49,13,36,65,52,70,95,23,04,60,11,42,69,24,68,56,01,32,56,71,37,02,36,91,22,31,16,71,51,67,63,89,41,92,36,54,22,40,40,28,66,33,13,80,24,47,32,60,99,03,45,02,44,75,33,53,78,36,84,20,35,17,12,50,32,98,81,28,64,23,67,10,26,38,40,67,59,54,70,66,18,38,64,70,67,26,20,68,02,62,12,20,95,63,94,39,63,8,40,91,66,49,94,21,24,55,58,05,66,73,99,26,97,17,78,78,96,83,14,88,34,89,63,72,21,36,23,9,75,00,76,44,20,45,35,14,00,61,33,97,34,31,33,95,78,17,53,28,22,75,31,67,15,94,03,80,04,62,16,14,9,53,56,92,16,39,05,42,96,35,31,47,55,58,88,24,00,17,54,24,36,29,85,57,86,56,00,48,35,71,89,07,05,44,44,37,44,60,21,58,51,54,17,58,19,80,81,68,05,94,47,69,28,73,92,13,86,52,17,77,04,89,55,40,04,52,8,83,97,35,99,16,07,97,57,32,16,26,26,79,33,27,98,66,88,36,68,87,57,62,20,72,03,46,33,67,46,55,12,32,63,93,53,69,04,42,16,73,38,25,39,11,24,94,72,18,8,46,29,32,40,62,76,36,20,69,36,41,72,30,23,88,34,62,99,69,82,67,59,85,74,04,36,16,20,73,35,29,78,31,90,01,74,31,49,71,48,86,81,16,23,57,05,54,01,70,54,71,83,51,54,69,16,92,33,48,61,43,52,01,89,19,67,48};&lt;br /&gt;    int i,j,max=0;&lt;br /&gt;    for(i=0;i&lt;20;i++)&lt;br /&gt;      for(j=0;j&lt;20;j++)&lt;br /&gt;      {&lt;br /&gt;          if((j+3&lt;20)&amp;&amp;(a[i][j]*a[i][j+1]*a[i][j+2]*a[i][j+3]&gt;max)) max=a[i][j]*a[i][j+1]*a[i][j+2]*a[i][j+3];/*row*/&lt;br /&gt;          if((i+3&lt;20)&amp;&amp;(a[i][j]*a[i+1][j]*a[i+2][j]*a[i+3][j]&gt;max)) max=a[i][j]*a[i+1][j]*a[i+2][j]*a[i+3][j];/*col*/&lt;br /&gt;          if((i+3&lt;20)&amp;&amp;(j-3&gt;=0)&amp;&amp;(a[i][j]*a[i+1][j-1]*a[i+2][j-2]*a[i+3][j-3]&gt;max)) max=a[i][j]*a[i+1][j-1]*a[i+2][j-2]*a[i+3][j-3];/*left*/&lt;br /&gt;          if((i+3&lt;20)&amp;&amp;(j+3&lt;20)&amp;&amp;(a[i][j]*a[i+1][j+1]*a[i+2][j+2]*a[i+3][j+3]&gt;max)) max=a[i][j]*a[i+1][j+1]*a[i+2][j+2]*a[i+3][j+3];/*right*/&lt;br /&gt;      }&lt;br /&gt;    printf("%d\n",max);&lt;br /&gt;    return 0;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/890102498135123039-1842554020335545178?l=dengcaiyun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dengcaiyun.blogspot.com/feeds/1842554020335545178/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=890102498135123039&amp;postID=1842554020335545178&amp;isPopup=true' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/1842554020335545178'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/1842554020335545178'/><link rel='alternate' type='text/html' href='http://dengcaiyun.blogspot.com/2009/05/problem-11-22-february-2002-in-2020.html' title='Problem 11'/><author><name>dengcaiyun</name><uri>http://www.blogger.com/profile/13995124280643652348</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-890102498135123039.post-4615610851236301118</id><published>2009-05-06T20:53:00.000+08:00</published><updated>2009-05-06T20:55:02.490+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Problem 10--(c)</title><content type='html'>Problem 10&lt;br /&gt;08 February 2002&lt;br /&gt;&lt;br /&gt;The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.&lt;br /&gt;&lt;br /&gt;Find the sum of all the primes below two million.&lt;br /&gt;&lt;br /&gt;Answer:&lt;br /&gt; 142913828922&lt;br /&gt;code:&lt;br /&gt;#include&lt;stdio.h&gt;&lt;br /&gt;#include&lt;math.h&gt;&lt;br /&gt;&lt;br /&gt;int primer(long int n)&lt;br /&gt;{&lt;br /&gt;    long long int flag=1,i;&lt;br /&gt;    for(i=2;i&lt;=sqrt(n)&amp;&amp;flag==1;i++)&lt;br /&gt;      if(n%i==0)&lt;br /&gt;        flag=0;&lt;br /&gt;    return(flag);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;int main(void)&lt;br /&gt;{&lt;br /&gt;    long long j=3,sum=2;/*忽略了2，所以要加上2*/&lt;br /&gt;    for(j=3;j&lt;2000000;j+=2)&lt;br /&gt;    {&lt;br /&gt;        if(primer(j))&lt;br /&gt;          sum+=j;&lt;br /&gt;    }&lt;br /&gt;    printf("%lld\n",sum);&lt;br /&gt;    return 0;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/890102498135123039-4615610851236301118?l=dengcaiyun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dengcaiyun.blogspot.com/feeds/4615610851236301118/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=890102498135123039&amp;postID=4615610851236301118&amp;isPopup=true' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/4615610851236301118'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/4615610851236301118'/><link rel='alternate' type='text/html' href='http://dengcaiyun.blogspot.com/2009/05/problem-10-c.html' title='Problem 10--(c)'/><author><name>dengcaiyun</name><uri>http://www.blogger.com/profile/13995124280643652348</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-890102498135123039.post-730008249921230601</id><published>2009-05-06T20:51:00.000+08:00</published><updated>2009-05-06T20:53:40.011+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Problem 9--(c)</title><content type='html'>Problem 9&lt;br /&gt;25 January 2002&lt;br /&gt;&lt;br /&gt;A Pythagorean triplet is a set of three natural numbers, a &lt; b &lt; c, for which,&lt;br /&gt;a^(2) + b^(2) = c^(2)&lt;br /&gt;&lt;br /&gt;For example, 3^(2) + 4^(2) = 9 + 16 = 25 = 5^(2).&lt;br /&gt;&lt;br /&gt;There exists exactly one Pythagorean triplet for which a + b + c = 1000.&lt;br /&gt;Find the product abc.&lt;br /&gt;&lt;br /&gt;Answer:&lt;br /&gt; 31875000&lt;br /&gt;#include&lt;stdio.h&gt;&lt;br /&gt;int main(void)&lt;br /&gt;{&lt;br /&gt;    int i,j;&lt;br /&gt;    for(i=1;i&lt;=500;i++)&lt;br /&gt;      for(j=1;j&lt;500;j++)&lt;br /&gt;      {&lt;br /&gt;          if(i*i+j*j==(1000-i-j)*(1000-i-j))&lt;br /&gt;            printf("%d\n",i*j*(1000-i-j));&lt;br /&gt;      }&lt;br /&gt;    return 0;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/890102498135123039-730008249921230601?l=dengcaiyun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dengcaiyun.blogspot.com/feeds/730008249921230601/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=890102498135123039&amp;postID=730008249921230601&amp;isPopup=true' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/730008249921230601'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/730008249921230601'/><link rel='alternate' type='text/html' href='http://dengcaiyun.blogspot.com/2009/05/problem-9-c.html' title='Problem 9--(c)'/><author><name>dengcaiyun</name><uri>http://www.blogger.com/profile/13995124280643652348</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-890102498135123039.post-249383214583749173</id><published>2009-05-06T20:50:00.001+08:00</published><updated>2009-05-06T20:50:57.940+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Problem 8--(c)</title><content type='html'>&lt;h2&gt;Problem 8&lt;/h2&gt; &lt;div style="color: rgb(102, 102, 102); font-size: 80%;"&gt;11 January 2002&lt;/div&gt;&lt;br /&gt;&lt;div class="problem_content"&gt;  &lt;p&gt;Find the greatest product of five consecutive digits in the 1000-digit number.&lt;/p&gt; &lt;p style="font-family: courier new; font-size: 10pt; text-align: center;"&gt; 73167176531330624919225119674426574742355349194934&lt;br /&gt;96983520312774506326239578318016984801869478851843&lt;br /&gt;85861560789112949495459501737958331952853208805511&lt;br /&gt;12540698747158523863050715693290963295227443043557&lt;br /&gt;66896648950445244523161731856403098711121722383113&lt;br /&gt;62229893423380308135336276614282806444486645238749&lt;br /&gt;30358907296290491560440772390713810515859307960866&lt;br /&gt;70172427121883998797908792274921901699720888093776&lt;br /&gt;65727333001053367881220235421809751254540594752243&lt;br /&gt;52584907711670556013604839586446706324415722155397&lt;br /&gt;53697817977846174064955149290862569321978468622482&lt;br /&gt;83972241375657056057490261407972968652414535100474&lt;br /&gt;82166370484403199890008895243450658541227588666881&lt;br /&gt;16427171479924442928230863465674813919123162824586&lt;br /&gt;17866458359124566529476545682848912883142607690042&lt;br /&gt;24219022671055626321111109370544217506941658960408&lt;br /&gt;07198403850962455444362981230987879927244284909188&lt;br /&gt;84580156166097919133875499200524063689912560717606&lt;br /&gt;05886116467109405077541002256983155200055935729725&lt;br /&gt;71636269561882670428252483600823257530420752963450&lt;br /&gt;&lt;/p&gt;  &lt;/div&gt;&lt;br /&gt;                 &lt;table width="100%" cellpadding="5"&gt;&lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;&lt;div class="info" style="text-align: right;"&gt;Answer:&lt;/div&gt;&lt;/td&gt;     &lt;td&gt; &lt;b&gt;40824&lt;/b&gt;    &lt;/td&gt;    &lt;/tr&gt;&lt;tr&gt;     &lt;td&gt;          &lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;code:&lt;br /&gt;#include&lt;stdio.h&gt;&lt;br /&gt;#include&lt;stdlib.h&gt;&lt;br /&gt;&lt;br /&gt;int xc(int a[],int n)&lt;br /&gt;{&lt;br /&gt;    return (a[n]*a[n+1]*a[n+2]*a[n+3]*a[n+4]);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;int main(void)&lt;br /&gt;{&lt;br /&gt;    int num[1000]={7,3,1,6,7,1,7,6,5,3,1,3,3,0,6,2,4,9,1,9,2,2,5,1,1,9,6,7,4,4,2,6,5,7,4,7,4,2,3,5,5,3,4,9,1,9,4,9,3,4,9,6,9,8,3,5,2,0,3,1,2,7,7,4,5,0,6,3,2,6,2,3,9,5,7,8,3,1,8,0,1,6,9,8,4,8,0,1,8,6,9,4,7,8,8,5,1,8,4,3,8,5,8,6,1,5,6,0,7,8,9,1,1,2,9,4,9,4,9,5,4,5,9,5,0,1,7,3,7,9,5,8,3,3,1,9,5,2,8,5,3,2,0,8,8,0,5,5,1,1,1,2,5,4,0,6,9,8,7,4,7,1,5,8,5,2,3,8,6,3,0,5,0,7,1,5,6,9,3,2,9,0,9,6,3,2,9,5,2,2,7,4,4,3,0,4,3,5,5,7,6,6,8,9,6,6,4,8,9,5,0,4,4,5,2,4,4,5,2,3,1,6,1,7,3,1,8,5,6,4,0,3,0,9,8,7,1,1,1,2,1,7,2,2,3,8,3,1,1,3,6,2,2,2,9,8,9,3,4,2,3,3,8,0,3,0,8,1,3,5,3,3,6,2,7,6,6,1,4,2,8,2,8,0,6,4,4,4,4,8,6,6,4,5,2,3,8,7,4,9,3,0,3,5,8,9,0,7,2,9,6,2,9,0,4,9,1,5,6,0,4,4,0,7,7,2,3,9,0,7,1,3,8,1,0,5,1,5,8,5,9,3,0,7,9,6,0,8,6,6,7,0,1,7,2,4,2,7,1,2,1,8,8,3,9,9,8,7,9,7,9,0,8,7,9,2,2,7,4,9,2,1,9,0,1,6,9,9,7,2,0,8,8,8,0,9,3,7,7,6,6,5,7,2,7,3,3,3,0,0,1,0,5,3,3,6,7,8,8,1,2,2,0,2,3,5,4,2,1,8,0,9,7,5,1,2,5,4,5,4,0,5,9,4,7,5,2,2,4,3,5,2,5,8,4,9,0,7,7,1,1,6,7,0,5,5,6,0,1,3,6,0,4,8,3,9,5,8,6,4,4,6,7,0,6,3,2,4,4,1,5,7,2,2,1,5,5,3,9,7,5,3,6,9,7,8,1,7,9,7,7,8,4,6,1,7,4,0,6,4,9,5,5,1,4,9,2,9,0,8,6,2,5,6,9,3,2,1,9,7,8,4,6,8,6,2,2,4,8,2,8,3,9,7,2,2,4,1,3,7,5,6,5,7,0,5,6,0,5,7,4,9,0,2,6,1,4,0,7,9,7,2,9,6,8,6,5,2,4,1,4,5,3,5,1,0,0,4,7,4,8,2,1,6,6,3,7,0,4,8,4,4,0,3,1,9,9,8,9,0,0,0,8,8,9,5,2,4,3,4,5,0,6,5,8,5,4,1,2,2,7,5,8,8,6,6,6,8,8,1,1,6,4,2,7,1,7,1,4,7,9,9,2,4,4,4,2,9,2,8,2,3,0,8,6,3,4,6,5,6,7,4,8,1,3,9,1,9,1,2,3,1,6,2,8,2,4,5,8,6,1,7,8,6,6,4,5,8,3,5,9,1,2,4,5,6,6,5,2,9,4,7,6,5,4,5,6,8,2,8,4,8,9,1,2,8,8,3,1,4,2,6,0,7,6,9,0,0,4,2,2,4,2,1,9,0,2,2,6,7,1,0,5,5,6,2,6,3,2,1,1,1,1,1,0,9,3,7,0,5,4,4,2,1,7,5,0,6,9,4,1,6,5,8,9,6,0,4,0,8,0,7,1,9,8,4,0,3,8,5,0,9,6,2,4,5,5,4,4,4,3,6,2,9,8,1,2,3,0,9,8,7,8,7,9,9,2,7,2,4,4,2,8,4,9,0,9,1,8,8,8,4,5,8,0,1,5,6,1,6,6,0,9,7,9,1,9,1,3,3,8,7,5,4,9,9,2,0,0,5,2,4,0,6,3,6,8,9,9,1,2,5,6,0,7,1,7,6,0,6,0,5,8,8,6,1,1,6,4,6,7,1,0,9,4,0,5,0,7,7,5,4,1,0,0,2,2,5,6,9,8,3,1,5,5,2,0,0,0,5,5,9,3,5,7,2,9,7,2,5,7,1,6,3,6,2,6,9,5,6,1,8,8,2,6,7,0,4,2,8,2,5,2,4,8,3,6,0,0,8,2,3,2,5,7,5,3,0,4,2,0,7,5,2,9,6,3,4,5,0};&lt;br /&gt;   &lt;br /&gt;    int max=0,i;&lt;br /&gt;    for(i=0;i&lt;=995;i++)&lt;br /&gt;    {&lt;br /&gt;        if(xc(num,i)&gt;max)&lt;br /&gt;          max=xc(num,i);&lt;br /&gt;    }&lt;br /&gt;    printf("%d\n",max);&lt;br /&gt;    return 0;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/890102498135123039-249383214583749173?l=dengcaiyun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dengcaiyun.blogspot.com/feeds/249383214583749173/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=890102498135123039&amp;postID=249383214583749173&amp;isPopup=true' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/249383214583749173'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/249383214583749173'/><link rel='alternate' type='text/html' href='http://dengcaiyun.blogspot.com/2009/05/problem-8-c.html' title='Problem 8--(c)'/><author><name>dengcaiyun</name><uri>http://www.blogger.com/profile/13995124280643652348</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-890102498135123039.post-7257425449178157200</id><published>2009-05-06T20:47:00.000+08:00</published><updated>2009-05-06T20:49:15.297+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Problem 7--(c)</title><content type='html'>&lt;h2&gt;Problem 7&lt;/h2&gt; &lt;div style="color: rgb(102, 102, 102); font-size: 80%;"&gt;28 December 2001&lt;/div&gt;&lt;br /&gt;&lt;div class="problem_content"&gt;  &lt;p&gt;By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6&lt;img src="http://projecteuler.net/index.php?section=problems&amp;amp;id=7" style="display: none;" alt="^(" /&gt;&lt;sup&gt;th&lt;/sup&gt;&lt;img src="http://projecteuler.net/index.php?section=problems&amp;amp;id=7" style="display: none;" alt=")" /&gt; prime is 13.&lt;/p&gt; &lt;p&gt;What is the 10001&lt;img src="http://projecteuler.net/index.php?section=problems&amp;amp;id=7" style="display: none;" alt="^(" /&gt;&lt;sup&gt;st&lt;/sup&gt;&lt;img src="http://projecteuler.net/index.php?section=problems&amp;amp;id=7" style="display: none;" alt=")" /&gt; prime number?&lt;/p&gt;  &lt;/div&gt;&lt;br /&gt;                      &lt;table width="100%" cellpadding="5"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="info" style="text-align: right;"&gt;Answer:&lt;/div&gt;&lt;/td&gt;     &lt;td&gt; &lt;b&gt;104743&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;code:&lt;br /&gt;#include&lt;stdio.h&gt;&lt;br /&gt;#include&lt;math.h&gt;&lt;br /&gt;&lt;br /&gt;int primer(long int n)&lt;br /&gt;{&lt;br /&gt;    int flag=1;&lt;br /&gt;    long int i;&lt;br /&gt;    for(i=2;i&lt;=sqrt(n)&amp;amp;&amp;amp;flag==1;i++)&lt;br /&gt;      if(n%i==0)&lt;br /&gt;        flag=0;&lt;br /&gt;    return (flag);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;int main(void)&lt;br /&gt;{&lt;br /&gt;    long int a[10001],num=3,i=1;/*忽略了2，这种情况，第10000，就是所求*/&lt;br /&gt;    while(i&lt;=10000)&lt;br /&gt;    {&lt;br /&gt;        if(primer(num))&lt;br /&gt;        {&lt;br /&gt;            a[i]=num;&lt;br /&gt;            i++;&lt;br /&gt;        }&lt;br /&gt;        num=num+2;&lt;br /&gt;    }&lt;br /&gt;    printf("%ld\n",a[10000]);&lt;br /&gt;    return 0;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/890102498135123039-7257425449178157200?l=dengcaiyun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dengcaiyun.blogspot.com/feeds/7257425449178157200/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=890102498135123039&amp;postID=7257425449178157200&amp;isPopup=true' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/7257425449178157200'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/7257425449178157200'/><link rel='alternate' type='text/html' href='http://dengcaiyun.blogspot.com/2009/05/problem-7-c.html' title='Problem 7--(c)'/><author><name>dengcaiyun</name><uri>http://www.blogger.com/profile/13995124280643652348</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-890102498135123039.post-8535478838625595166</id><published>2009-05-06T20:44:00.000+08:00</published><updated>2009-05-06T20:47:21.604+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Problem 6--(c)</title><content type='html'>&lt;div style="color: rgb(102, 102, 102); font-size: 80%;"&gt;14 December 2001&lt;/div&gt;&lt;br /&gt;&lt;div class="problem_content"&gt; &lt;p&gt;The sum of the squares of the first ten natural numbers is,&lt;/p&gt; &lt;div style="text-align: center;"&gt;1&lt;img src="http://projecteuler.net/index.php?section=problems&amp;amp;id=6" style="display: none;" alt="^(" /&gt;&lt;sup&gt;2&lt;/sup&gt;&lt;img src="http://projecteuler.net/index.php?section=problems&amp;amp;id=6" style="display: none;" alt=")" /&gt; + 2&lt;img src="http://projecteuler.net/index.php?section=problems&amp;amp;id=6" style="display: none;" alt="^(" /&gt;&lt;sup&gt;2&lt;/sup&gt;&lt;img src="http://projecteuler.net/index.php?section=problems&amp;amp;id=6" style="display: none;" alt=")" /&gt; + ... + 10&lt;img src="http://projecteuler.net/index.php?section=problems&amp;amp;id=6" style="display: none;" alt="^(" /&gt;&lt;sup&gt;2&lt;/sup&gt;&lt;img src="http://projecteuler.net/index.php?section=problems&amp;amp;id=6" style="display: none;" alt=")" /&gt; = 385&lt;/div&gt; &lt;p&gt;The square of the sum of the first ten natural numbers is,&lt;/p&gt; &lt;div style="text-align: center;"&gt;(1 + 2 + ... + 10)&lt;img src="http://projecteuler.net/index.php?section=problems&amp;amp;id=6" style="display: none;" alt="^(" /&gt;&lt;sup&gt;2&lt;/sup&gt;&lt;img src="http://projecteuler.net/index.php?section=problems&amp;amp;id=6" style="display: none;" alt=")" /&gt; = 55&lt;img src="http://projecteuler.net/index.php?section=problems&amp;amp;id=6" style="display: none;" alt="^(" /&gt;&lt;sup&gt;2&lt;/sup&gt;&lt;img src="http://projecteuler.net/index.php?section=problems&amp;amp;id=6" style="display: none;" alt=")" /&gt; = 3025&lt;/div&gt; &lt;p&gt;Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 &lt;img src="http://projecteuler.net/images/symbol_minus.gif" alt="−" style="vertical-align: middle;" width="9" border="0" height="3" /&gt; 385 = 2640.&lt;/p&gt; &lt;p&gt;Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.&lt;/p&gt;  &lt;/div&gt;&lt;br /&gt;                     &lt;table width="100%" cellpadding="5"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="info" style="text-align: right;"&gt;Answer:&lt;/div&gt;&lt;/td&gt;     &lt;td&gt; &lt;b&gt;25164150&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;code:&lt;br /&gt;#include&lt;stdio.h&gt;&lt;br /&gt;int main(void)&lt;br /&gt;{&lt;br /&gt;    int i;&lt;br /&gt;    long int s1=0,s2=0;&lt;br /&gt;    for(i=1;i&lt;=100;i++)&lt;br /&gt;    {&lt;br /&gt;        s1+=i*i;&lt;br /&gt;        s2+=i;&lt;br /&gt;    }&lt;br /&gt;    printf("%ld\n",s2*s2-s1);&lt;br /&gt;    return 0;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/890102498135123039-8535478838625595166?l=dengcaiyun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dengcaiyun.blogspot.com/feeds/8535478838625595166/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=890102498135123039&amp;postID=8535478838625595166&amp;isPopup=true' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/8535478838625595166'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/8535478838625595166'/><link rel='alternate' type='text/html' href='http://dengcaiyun.blogspot.com/2009/05/problem-6-c.html' title='Problem 6--(c)'/><author><name>dengcaiyun</name><uri>http://www.blogger.com/profile/13995124280643652348</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-890102498135123039.post-7373894448945653632</id><published>2009-05-06T20:42:00.000+08:00</published><updated>2009-05-06T20:44:10.601+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Problem 5--(c)</title><content type='html'>&lt;h2&gt;Problem 5&lt;/h2&gt; &lt;div style="color: rgb(102, 102, 102); font-size: 80%;"&gt;30 November 2001&lt;/div&gt;&lt;br /&gt;&lt;div class="problem_content"&gt; &lt;p&gt;2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.&lt;/p&gt; &lt;p&gt;What is the smallest number that is &lt;dfn title="divisible with no remainder"&gt;evenly divisible&lt;/dfn&gt; by all of the numbers from 1 to 20?&lt;/p&gt;  &lt;/div&gt;&lt;br /&gt;                      &lt;table width="100%" cellpadding="5"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="info" style="text-align: right;"&gt;Answer:&lt;/div&gt;&lt;/td&gt;     &lt;td&gt; &lt;b&gt;232792560&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;code:&lt;br /&gt;#include&lt;stdio.h&gt;&lt;br /&gt;int main(void)&lt;br /&gt;{&lt;br /&gt;    long int max=2520;&lt;br /&gt;    int i;&lt;br /&gt;    while(1)&lt;br /&gt;    {&lt;br /&gt;        for(i=1;i&lt;=20;i++)&lt;br /&gt;        {&lt;br /&gt;        if(max%i!=0)&lt;br /&gt;          break;&lt;br /&gt;        }&lt;br /&gt;        if(i==21&amp;amp;&amp;amp;max%20==0)&lt;br /&gt;        {&lt;br /&gt;            printf("%ld\n",max);&lt;br /&gt;            break;&lt;br /&gt;        }&lt;br /&gt;        max+=1;&lt;br /&gt;    }&lt;br /&gt;    return 0;&lt;br /&gt;｝&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/890102498135123039-7373894448945653632?l=dengcaiyun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dengcaiyun.blogspot.com/feeds/7373894448945653632/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=890102498135123039&amp;postID=7373894448945653632&amp;isPopup=true' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/7373894448945653632'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/7373894448945653632'/><link rel='alternate' type='text/html' href='http://dengcaiyun.blogspot.com/2009/05/problem-5-c.html' title='Problem 5--(c)'/><author><name>dengcaiyun</name><uri>http://www.blogger.com/profile/13995124280643652348</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-890102498135123039.post-9139524479865223009</id><published>2009-05-06T20:35:00.000+08:00</published><updated>2009-05-06T20:40:44.129+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Problem 4--(c)</title><content type='html'>&lt;h2&gt;Problem 4&lt;span style="font-size:130%;"&gt;&lt;stdio.h&gt;&lt;/stdio.h&gt;&lt;/span&gt;&lt;/h2&gt; &lt;div style="color: rgb(102, 102, 102); font-size: 80%;"&gt;16 November 2001&lt;/div&gt;&lt;br /&gt;&lt;div class="problem_content"&gt;  &lt;p&gt;A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 &lt;img src="http://projecteuler.net/images/symbol_times.gif" alt="×" style="vertical-align: middle;" width="9" border="0" height="9" /&gt; 99.&lt;/p&gt; &lt;p&gt;Find the largest palindrome made from the product of two 3-digit numbers.&lt;/p&gt;  &lt;/div&gt;&lt;br /&gt;                &lt;table width="100%" cellpadding="5"&gt;&lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;&lt;div class="info" style="text-align: right;"&gt;Answer:&lt;/div&gt;&lt;/td&gt;     &lt;td&gt; &lt;b&gt;906609&lt;/b&gt;    &lt;/td&gt;    &lt;/tr&gt;&lt;tr&gt;     &lt;td&gt;         &lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;code:&lt;br /&gt;&lt;h2&gt;&lt;span&gt;&lt;span style="font-size:130%;"&gt;#include&lt;stdio.h&gt;&lt;br /&gt;int PD(int num)&lt;br /&gt;{&lt;br /&gt;     if(num&gt;99999)&lt;br /&gt;   {&lt;br /&gt;     if((num/100000==num%10)&amp;amp;&amp;amp;((num%100000)/10000==(num%100)/10)&amp;amp;&amp;amp;(num/1000%10==(num%1000)/100))&lt;br /&gt;        return 1;&lt;br /&gt;     else&lt;br /&gt;         return 0;&lt;br /&gt;   }&lt;br /&gt;else&lt;br /&gt;   {&lt;br /&gt;         if((num/10000==num%10)&amp;amp;&amp;amp;(num%10000)/1000==(num%100)/10)&lt;br /&gt;            return 1;&lt;br /&gt;         else&lt;br /&gt;            return 0;&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;int main(void)&lt;br /&gt;{&lt;br /&gt;     int i,j,max=10000;&lt;br /&gt;     for(i=999;i&gt;99;i--)&lt;br /&gt;        for(j=999;j&gt;99;j--)&lt;br /&gt;           if(PD(i*j)==1&amp;amp;&amp;amp;i*j&gt;max)&lt;br /&gt;              max=i*j;&lt;br /&gt;          printf("%d\n",max);&lt;br /&gt;     return 0;&lt;br /&gt;}&lt;/stdio.h&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/890102498135123039-9139524479865223009?l=dengcaiyun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dengcaiyun.blogspot.com/feeds/9139524479865223009/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=890102498135123039&amp;postID=9139524479865223009&amp;isPopup=true' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/9139524479865223009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/9139524479865223009'/><link rel='alternate' type='text/html' href='http://dengcaiyun.blogspot.com/2009/05/problem-4-c.html' title='Problem 4--(c)'/><author><name>dengcaiyun</name><uri>http://www.blogger.com/profile/13995124280643652348</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-890102498135123039.post-5337582307829637836</id><published>2009-05-06T20:32:00.000+08:00</published><updated>2009-05-06T20:35:18.182+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Problem 3--(c)</title><content type='html'>&lt;h2&gt;Problem 3&lt;/h2&gt; &lt;div style="color: rgb(102, 102, 102); font-size: 80%;"&gt;02 November 2001&lt;/div&gt;&lt;br /&gt;&lt;div class="problem_content"&gt; &lt;p&gt;The prime factors of 13195 are 5, 7, 13 and 29.&lt;/p&gt; &lt;p&gt;What is the largest prime factor of the number 600851475143 ?&lt;/p&gt; &lt;!-- Note: This problem has been changed recently, please check that you are using the right number. --&gt;  &lt;/div&gt;&lt;br /&gt;                     &lt;table width="100%" cellpadding="5"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="info" style="text-align: right;"&gt;Answer:&lt;/div&gt;&lt;/td&gt;     &lt;td&gt; &lt;b&gt;6857&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;code:&lt;br /&gt;&lt;p&gt;解法1：&lt;/p&gt;&lt;p&gt;#include&lt;stdio.h&gt;&lt;br /&gt;int main(void)&lt;br /&gt;{&lt;br /&gt;   long long int num=600851475143,res=2;&lt;br /&gt;   while(res!=num)&lt;br /&gt;   {&lt;br /&gt;       if(num%res==0)&lt;br /&gt;         num=num/res;&lt;br /&gt;       else&lt;br /&gt;         res++;&lt;br /&gt;   }&lt;br /&gt;   printf("%lld\n",res);&lt;br /&gt;   return 0;&lt;br /&gt;}&lt;/stdio.h&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;解法2：&lt;/p&gt;&lt;p&gt;#include&lt;stdio.h&gt;&lt;br /&gt;#include&lt;math.h&gt;&lt;br /&gt;int prime(long long int n)&lt;br /&gt;{&lt;br /&gt;   int flag=1;&lt;br /&gt;   long long int i;&lt;br /&gt;   for(i=2;i&lt;=sqrt(n)&amp;amp;&amp;amp;flag==1;i++)       if(n%i==0) flag=0;     return (flag); } int main(void) {     long long int i,j=600851475143,k,max;     k=sqrt(j);     for(i=3;i&lt;=k;i=i+2)     {         if(prime(i)==1&amp;amp;&amp;amp;j%i==0) max=i;     }     printf("%lld ",max);     return 0; }&lt;/math.h&gt;&lt;/stdio.h&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/890102498135123039-5337582307829637836?l=dengcaiyun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dengcaiyun.blogspot.com/feeds/5337582307829637836/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=890102498135123039&amp;postID=5337582307829637836&amp;isPopup=true' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/5337582307829637836'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/5337582307829637836'/><link rel='alternate' type='text/html' href='http://dengcaiyun.blogspot.com/2009/05/problem-3-02-november-2001-prime.html' title='Problem 3--(c)'/><author><name>dengcaiyun</name><uri>http://www.blogger.com/profile/13995124280643652348</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-890102498135123039.post-4258673581776598283</id><published>2009-05-06T20:26:00.000+08:00</published><updated>2009-05-06T20:35:38.512+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Problem 2--(c)</title><content type='html'>&lt;h2&gt;Problem 2&lt;/h2&gt; &lt;div style="color: rgb(102, 102, 102); font-size: 80%;"&gt;19 October 2001&lt;/div&gt;&lt;br /&gt;&lt;div class="problem_content"&gt; &lt;p&gt;Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:&lt;/p&gt; &lt;p style="text-align: center;"&gt;1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...&lt;/p&gt; &lt;p&gt;Find the sum of all the even-valued terms in the sequence which do not exceed four million.&lt;/p&gt; &lt;!-- Note: This problem has been changed recently, please check that you are using the right parameters. --&gt; &lt;/div&gt;&lt;br /&gt;                &lt;table width="100%" cellpadding="5"&gt;&lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;&lt;div class="info" style="text-align: right;"&gt;Answer:&lt;/div&gt;&lt;/td&gt;     &lt;td&gt; &lt;b&gt;4613732&lt;/b&gt;    &lt;/td&gt;    &lt;/tr&gt;&lt;tr&gt;     &lt;td&gt;         &lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;code:&lt;br /&gt;#include&lt;stdio.h&gt;&lt;br /&gt;int main(void)&lt;br /&gt;{&lt;br /&gt;   int f1=1,f2=2,sum=0,t;&lt;br /&gt;   while(f2&lt;4000000)&lt;br /&gt;   {&lt;br /&gt;       if(f2%2==0)&lt;br /&gt;       sum+=f2;&lt;br /&gt;       t=f1;&lt;br /&gt;       f1=f2;&lt;br /&gt;       f2=f2+t;&lt;br /&gt;   }&lt;br /&gt;   printf("%d\n",sum);&lt;br /&gt;   return 0;&lt;br /&gt;}&lt;/stdio.h&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/890102498135123039-4258673581776598283?l=dengcaiyun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dengcaiyun.blogspot.com/feeds/4258673581776598283/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=890102498135123039&amp;postID=4258673581776598283&amp;isPopup=true' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/4258673581776598283'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/4258673581776598283'/><link rel='alternate' type='text/html' href='http://dengcaiyun.blogspot.com/2009/05/problem-2-c.html' title='Problem 2--(c)'/><author><name>dengcaiyun</name><uri>http://www.blogger.com/profile/13995124280643652348</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-890102498135123039.post-6444519592136641937</id><published>2009-05-06T20:20:00.000+08:00</published><updated>2009-05-06T20:25:51.956+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Problem 1--(c)</title><content type='html'>&lt;h2&gt;Problem 1&lt;/h2&gt; &lt;div style="color: rgb(102, 102, 102); font-size: 80%;"&gt;05 October 2001&lt;/div&gt;&lt;br /&gt;&lt;div class="problem_content"&gt; &lt;p&gt;If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.&lt;/p&gt; &lt;p&gt;Find the sum of all the multiples of 3 or 5 below 1000.&lt;/p&gt;  &lt;/div&gt;&lt;br /&gt;                 &lt;table width="100%" cellpadding="5"&gt;&lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;&lt;div class="info" style="text-align: right;"&gt;Answer:&lt;/div&gt;&lt;/td&gt;     &lt;td&gt; &lt;b&gt;233168&lt;/b&gt;    &lt;/td&gt;    &lt;/tr&gt;&lt;tr&gt;     &lt;td&gt;          &lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;code:&lt;br /&gt;#include&lt;stdio.h&gt;&lt;br /&gt;int main(void)&lt;br /&gt;{&lt;br /&gt;    int num,sum=0;&lt;br /&gt;    for(num=1;num&lt;1000;num++)&lt;br /&gt;    {&lt;br /&gt;        if(num%3==0||num%5==0)&lt;br /&gt;          sum+=num;&lt;br /&gt;    }&lt;br /&gt;    printf("%d\n",sum);&lt;br /&gt;    return 0;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/890102498135123039-6444519592136641937?l=dengcaiyun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dengcaiyun.blogspot.com/feeds/6444519592136641937/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=890102498135123039&amp;postID=6444519592136641937&amp;isPopup=true' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/6444519592136641937'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/6444519592136641937'/><link rel='alternate' type='text/html' href='http://dengcaiyun.blogspot.com/2009/05/problem-1-c.html' title='Problem 1--(c)'/><author><name>dengcaiyun</name><uri>http://www.blogger.com/profile/13995124280643652348</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-890102498135123039.post-9084636366898952375</id><published>2009-05-06T15:21:00.000+08:00</published><updated>2009-05-06T15:45:47.525+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux(Ubuntu)'/><title type='text'>Firefox乱码（方格）</title><content type='html'>删除49-sansserif.conf文件做完后重启firefox就可以了。&lt;br /&gt;&lt;br /&gt;    sudo rm /etc/fonts/conf.d/49-sansserif.conf&lt;br /&gt;简单，呵呵……&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/890102498135123039-9084636366898952375?l=dengcaiyun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dengcaiyun.blogspot.com/feeds/9084636366898952375/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=890102498135123039&amp;postID=9084636366898952375&amp;isPopup=true' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/9084636366898952375'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/9084636366898952375'/><link rel='alternate' type='text/html' href='http://dengcaiyun.blogspot.com/2009/05/firefox.html' title='Firefox乱码（方格）'/><author><name>dengcaiyun</name><uri>http://www.blogger.com/profile/13995124280643652348</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-890102498135123039.post-1248921275416445204</id><published>2009-05-05T20:01:00.000+08:00</published><updated>2009-05-05T20:02:28.419+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programme'/><title type='text'>超长整数运算</title><content type='html'>&lt;h2&gt;說明&lt;/h2&gt;基於記憶體的有效運用，程式語言中規定了各種不同的資料型態，也因此變數所可以表達的最大整數受到限制，例如 123456789123456789這樣的整數就不可能儲存在long變數中（例如C/C++等），我們稱這為long數，這邊翻為超長整數（避免與資 料型態的長整數翻譯混淆），或俗稱大數運算。&lt;br /&gt;     &lt;h2&gt;解法&lt;/h2&gt;      &lt;small&gt;一個變數無法表示超長整數，則就使用多個變數，當然這使用陣列最為方便，假設程式語言的最大資料型態可以儲存至65535的數好了，為了計算方便及符合使用十進位制的習慣，讓每一個陣列元素可以儲存四個位數，也就是0到9999的數，例如： &lt;/small&gt;&lt;br /&gt;     &lt;img style="width: 445px; height: 356px;" alt="大數運算" title="大數運算" src="http://202.193.64.35/dept7/acm/web/AlgorithmGossip/images/bigNumber-1.jpg" /&gt;&lt;br /&gt;    &lt;br /&gt;     &lt;small&gt;很多人問到如何計算像50!這樣的問題，解法就是使用程式中的乘法函式，至於要算到多大，就看需求了。&lt;br /&gt;    &lt;br /&gt;如果您使用的是Java，那麼在java.lang下有BigInteger與BigDecimal可以直接進行大數運算。&lt;br /&gt;    &lt;br /&gt;由於使用陣列來儲存數值，關於數值在運算時的加減乘除等各種運算、位數的進位或借位就必須自行定義，加、減、乘都是由低位數開始運算，而除法則是由高位數開始運算，這邊直接提供加減乘除運算的函式供作參考，以下的N為陣列長度。 &lt;/small&gt;     &lt;br /&gt;    &lt;br /&gt;     &lt;h2&gt; 實作&lt;/h2&gt;      &lt;ul&gt;&lt;li&gt; C &lt;/li&gt;&lt;/ul&gt;      &lt;pre&gt;void add(int *a, int *b, int *c) {&lt;br /&gt;   int i, carry = 0;&lt;br /&gt;&lt;br /&gt;   for(i = N - 1; i &gt;= 0; i--) {&lt;br /&gt;       c[i] = a[i] + b[i] + carry;&lt;br /&gt;       if(c[i] &lt; 10000)&lt;br /&gt;           carry = 0;&lt;br /&gt;       else { // 進位&lt;br /&gt;           c[i] = c[i] - 10000;&lt;br /&gt;           carry = 1;&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void sub(int *a, int *b, int *c) {&lt;br /&gt;   int i, borrow = 0;&lt;br /&gt;&lt;br /&gt;   for(i = N - 1; i &gt;= 0; i--) {&lt;br /&gt;       c[i] = a[i] - b[i] - borrow;&lt;br /&gt;       if(c[i] &gt;= 0)&lt;br /&gt;           borrow = 0;&lt;br /&gt;       else { // 借位&lt;br /&gt;           c[i] = c[i] + 10000;&lt;br /&gt;           borrow = 1;&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void mul(int *a, int b, int *c) { // b 為乘數&lt;br /&gt;   int i, tmp, carry = 0;&lt;br /&gt;&lt;br /&gt;   for(i = N - 1; i &gt;=0; i--) {&lt;br /&gt;       tmp = a[i] * b + carry;&lt;br /&gt;       c[i] = tmp % 10000;   &lt;br /&gt;       carry = tmp / 10000;&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void div(int *a, int b, int *c) {  // b 為除數&lt;br /&gt;   int i, tmp, remain = 0;&lt;br /&gt;&lt;br /&gt;   for(i = 0; i &lt; N; i++) {&lt;br /&gt;       tmp = a[i] + remain;&lt;br /&gt;       c[i] = tmp / b;&lt;br /&gt;       remain = (tmp % b) * 10000;&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;     &lt;br /&gt;     &lt;ul&gt;&lt;li&gt; Java &lt;/li&gt;&lt;/ul&gt;      &lt;pre&gt;public class BigNumber {&lt;br /&gt;   public static int[] add(int[] a, int[] b) {&lt;br /&gt;       int carry = 0;&lt;br /&gt;       int[] c = new int[a.length];&lt;br /&gt;&lt;br /&gt;       for(int i = a.length - 1; i &gt;= 0; i--) {&lt;br /&gt;           c[i] = a[i] + b[i] + carry;&lt;br /&gt;           if(c[i] &lt; 10000)&lt;br /&gt;               carry = 0;&lt;br /&gt;           else { // 進位&lt;br /&gt;               c[i] = c[i] - 10000;&lt;br /&gt;               carry = 1;&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;      &lt;br /&gt;       return c;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   public static int[] sub(int[] a, int[] b) {&lt;br /&gt;       int borrow = 0;&lt;br /&gt;       int[] c = new int[a.length];&lt;br /&gt;      &lt;br /&gt;       for(int i = a.length - 1; i &gt;= 0; i--) {&lt;br /&gt;           c[i] = a[i] - b[i] - borrow;&lt;br /&gt;           if(c[i] &gt;= 0)&lt;br /&gt;               borrow = 0;&lt;br /&gt;           else { // 借位&lt;br /&gt;               c[i] = c[i] + 10000;&lt;br /&gt;               borrow = 1;&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;      &lt;br /&gt;       return c;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   public static int[] mul(int[] a, int b) { // b 為乘數&lt;br /&gt;       int carry = 0;&lt;br /&gt;       int[] c = new int[a.length];&lt;br /&gt;      &lt;br /&gt;       for(int i = a.length - 1; i &gt;=0; i--) {&lt;br /&gt;           int tmp = a[i] * b + carry;&lt;br /&gt;           c[i] = tmp % 10000;   &lt;br /&gt;           carry = tmp / 10000;&lt;br /&gt;       }&lt;br /&gt;      &lt;br /&gt;       return c;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   public static int[] div(int[] a, int b) {  // b 為除數&lt;br /&gt;       int remain = 0;&lt;br /&gt;       int[] c = new int[a.length];&lt;br /&gt;&lt;br /&gt;       for(int i = 0; i &lt; a.length; i++) {&lt;br /&gt;           int tmp = a[i] + remain;&lt;br /&gt;           c[i] = tmp / b;&lt;br /&gt;           remain = (tmp % b) * 10000;&lt;br /&gt;       }&lt;br /&gt;      &lt;br /&gt;       return c;&lt;br /&gt;   }&lt;br /&gt;  &lt;br /&gt;   public static void main(String[] args) {&lt;br /&gt;       int[] a = {1234, 5678, 9910, 1923, 1124};&lt;br /&gt;       int[] b = {1234, 5678, 9910, 1923, 1124};&lt;br /&gt;       int[] c = BigNumber.add(a, b);&lt;br /&gt;      &lt;br /&gt;       for(int i = 0; i &lt; c.length; i++) {&lt;br /&gt;           System.out.print(c[i]);&lt;br /&gt;       }&lt;br /&gt;       System.out.println();&lt;br /&gt;   }&lt;br /&gt;}&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/890102498135123039-1248921275416445204?l=dengcaiyun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dengcaiyun.blogspot.com/feeds/1248921275416445204/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=890102498135123039&amp;postID=1248921275416445204&amp;isPopup=true' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/1248921275416445204'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/890102498135123039/posts/default/1248921275416445204'/><link rel='alternate' type='text/html' href='http://dengcaiyun.blogspot.com/2009/05/blog-post_05.html' title='超长整数运算'/><author><name>dengcaiyun</name><uri>http://www.blogger.com/profile/13995124280643652348</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
