鱼C论坛

 找回密码
 立即注册
查看: 5301|回复: 45

题目13:找出100个50位数之和的前十位数字

[复制链接]
发表于 2015-4-21 16:20:02 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
Large sum

Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.

37107287533902102798797998220837590246510135740250
46376937677490009712648124896970078050417018260538
74324986199524741059474233309513058123726617309629
91942213363574161572522430563301811072406154908250
23067588207539346171171980310421047513778063246676
89261670696623633820136378418383684178734361726757
28112879812849979408065481931592621691275889832738
44274228917432520321923589422876796487670272189318
47451445736001306439091167216856844588711603153276
70386486105843025439939619828917593665686757934951
62176457141856560629502157223196586755079324193331
64906352462741904929101432445813822663347944758178
92575867718337217661963751590579239728245598838407
58203565325359399008402633568948830189458628227828
80181199384826282014278194139940567587151170094390
35398664372827112653829987240784473053190104293586
86515506006295864861532075273371959191420517255829
71693888707715466499115593487603532921714970056938
54370070576826684624621495650076471787294438377604
53282654108756828443191190634694037855217779295145
36123272525000296071075082563815656710885258350721
45876576172410976447339110607218265236877223636045
17423706905851860660448207621209813287860733969412
81142660418086830619328460811191061556940512689692
51934325451728388641918047049293215058642563049483
62467221648435076201727918039944693004732956340691
15732444386908125794514089057706229429197107928209
55037687525678773091862540744969844508330393682126
18336384825330154686196124348767681297534375946515
80386287592878490201521685554828717201219257766954
78182833757993103614740356856449095527097864797581
16726320100436897842553539920931837441497806860984
48403098129077791799088218795327364475675590848030
87086987551392711854517078544161852424320693150332
59959406895756536782107074926966537676326235447210
69793950679652694742597709739166693763042633987085
41052684708299085211399427365734116182760315001271
65378607361501080857009149939512557028198746004375
35829035317434717326932123578154982629742552737307
94953759765105305946966067683156574377167401875275
88902802571733229619176668713819931811048770190271
25267680276078003013678680992525463401061632866526
36270218540497705585629946580636237993140746255962
24074486908231174977792365466257246923322810917141
91430288197103288597806669760892938638285025333403
34413065578016127815921815005561868836468420090470
23053081172816430487623791969842487255036638784583
11487696932154902810424020138335124462181441773470
63783299490636259666498587618221225225512486764533
67720186971698544312419572409913959008952310058822
95548255300263520781532296796249481641953868218774
76085327132285723110424803456124867697064507995236
37774242535411291684276865538926205024910326572967
23701913275725675285653248258265463092207058596522
29798860272258331913126375147341994889534765745501
18495701454879288984856827726077713721403798879715
38298203783031473527721580348144513491373226651381
34829543829199918180278916522431027392251122869539
40957953066405232632538044100059654939159879593635
29746152185502371307642255121183693803580388584903
41698116222072977186158236678424689157993532961922
62467957194401269043877107275048102390895523597457
23189706772547915061505504953922979530901129967519
86188088225875314529584099251203829009407770775672
11306739708304724483816533873502340845647058077308
82959174767140363198008187129011875491310547126581
97623331044818386269515456334926366572897563400500
42846280183517070527831839425882145521227251250327
55121603546981200581762165212827652751691296897789
32238195734329339946437501907836945765883352399886
75506164965184775180738168837861091527357929701337
62177842752192623401942399639168044983993173312731
32924185707147349566916674687634660915035914677504
99518671430235219628894890102423325116913619626622
73267460800591547471830798392868535206946944540724
76841822524674417161514036427982273348055556214818
97142617910342598647204516893989422179826088076852
87783646182799346313767754307809363333018982642090
10848802521674670883215120185883543223812876952786
71329612474782464538636993009049310363619763878039
62184073572399794223406235393808339651327408011116
66627891981488087797941876876144230030984490851411
60661826293682836764744779239180335110989069790714
85786944089552990653640447425576083659976645795096
66024396409905389607120198219976047599490197230297
64913982680032973156037120041377903785566085089252
16730939319872750275468906903707539413042652315011
94809377245048795150954100921645863754710598436791
78639167021187492431995700641917969777599028300699
15368713711936614952811305876380278410754449733078
40789923115535562561142322423255033685442488917353
44889911501440648020369068063960672322193204149535
41503128880339536053299340368006977710650566631954
81234880673210146739058568557934581403627822703280
82616570773948327592232845941706525094512325230608
22918802058777319719839450180888072429661980811197
77158542502016545090413245809786882778948721859617
72107838435069186155435662884062257473692284509516
20849603980134001723930671666823555245252804609722
53503534226472524250874054075591789781264330331690

题目:

找出以下 100 个 50 位数之和的前十位数字。

37107287533902102798797998220837590246510135740250
46376937677490009712648124896970078050417018260538
74324986199524741059474233309513058123726617309629
91942213363574161572522430563301811072406154908250
23067588207539346171171980310421047513778063246676
89261670696623633820136378418383684178734361726757
28112879812849979408065481931592621691275889832738
44274228917432520321923589422876796487670272189318
47451445736001306439091167216856844588711603153276
70386486105843025439939619828917593665686757934951
62176457141856560629502157223196586755079324193331
64906352462741904929101432445813822663347944758178
92575867718337217661963751590579239728245598838407
58203565325359399008402633568948830189458628227828
80181199384826282014278194139940567587151170094390
35398664372827112653829987240784473053190104293586
86515506006295864861532075273371959191420517255829
71693888707715466499115593487603532921714970056938
54370070576826684624621495650076471787294438377604
53282654108756828443191190634694037855217779295145
36123272525000296071075082563815656710885258350721
45876576172410976447339110607218265236877223636045
17423706905851860660448207621209813287860733969412
81142660418086830619328460811191061556940512689692
51934325451728388641918047049293215058642563049483
62467221648435076201727918039944693004732956340691
15732444386908125794514089057706229429197107928209
55037687525678773091862540744969844508330393682126
18336384825330154686196124348767681297534375946515
80386287592878490201521685554828717201219257766954
78182833757993103614740356856449095527097864797581
16726320100436897842553539920931837441497806860984
48403098129077791799088218795327364475675590848030
87086987551392711854517078544161852424320693150332
59959406895756536782107074926966537676326235447210
69793950679652694742597709739166693763042633987085
41052684708299085211399427365734116182760315001271
65378607361501080857009149939512557028198746004375
35829035317434717326932123578154982629742552737307
94953759765105305946966067683156574377167401875275
88902802571733229619176668713819931811048770190271
25267680276078003013678680992525463401061632866526
36270218540497705585629946580636237993140746255962
24074486908231174977792365466257246923322810917141
91430288197103288597806669760892938638285025333403
34413065578016127815921815005561868836468420090470
23053081172816430487623791969842487255036638784583
11487696932154902810424020138335124462181441773470
63783299490636259666498587618221225225512486764533
67720186971698544312419572409913959008952310058822
95548255300263520781532296796249481641953868218774
76085327132285723110424803456124867697064507995236
37774242535411291684276865538926205024910326572967
23701913275725675285653248258265463092207058596522
29798860272258331913126375147341994889534765745501
18495701454879288984856827726077713721403798879715
38298203783031473527721580348144513491373226651381
34829543829199918180278916522431027392251122869539
40957953066405232632538044100059654939159879593635
29746152185502371307642255121183693803580388584903
41698116222072977186158236678424689157993532961922
62467957194401269043877107275048102390895523597457
23189706772547915061505504953922979530901129967519
86188088225875314529584099251203829009407770775672
11306739708304724483816533873502340845647058077308
82959174767140363198008187129011875491310547126581
97623331044818386269515456334926366572897563400500
42846280183517070527831839425882145521227251250327
55121603546981200581762165212827652751691296897789
32238195734329339946437501907836945765883352399886
75506164965184775180738168837861091527357929701337
62177842752192623401942399639168044983993173312731
32924185707147349566916674687634660915035914677504
99518671430235219628894890102423325116913619626622
73267460800591547471830798392868535206946944540724
76841822524674417161514036427982273348055556214818
97142617910342598647204516893989422179826088076852
87783646182799346313767754307809363333018982642090
10848802521674670883215120185883543223812876952786
71329612474782464538636993009049310363619763878039
62184073572399794223406235393808339651327408011116
66627891981488087797941876876144230030984490851411
60661826293682836764744779239180335110989069790714
85786944089552990653640447425576083659976645795096
66024396409905389607120198219976047599490197230297
64913982680032973156037120041377903785566085089252
16730939319872750275468906903707539413042652315011
94809377245048795150954100921645863754710598436791
78639167021187492431995700641917969777599028300699
15368713711936614952811305876380278410754449733078
40789923115535562561142322423255033685442488917353
44889911501440648020369068063960672322193204149535
41503128880339536053299340368006977710650566631954
81234880673210146739058568557934581403627822703280
82616570773948327592232845941706525094512325230608
22918802058777319719839450180888072429661980811197
77158542502016545090413245809786882778948721859617
72107838435069186155435662884062257473692284509516
20849603980134001723930671666823555245252804609722
53503534226472524250874054075591789781264330331690

评分

参与人数 1鱼币 +1 收起 理由
cwhsmile + 1 5537376230,用时0.05s

查看全部评分

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2015-9-1 22:28:38 | 显示全部楼层
本帖最后由 翅膀团 于 2015-11-16 14:14 编辑
  1. #include <stdio.h>
  2. #include <stdlib.h>

  3. int main(void)
  4. {
  5.     char a0[] = "37107287533902102798797998220837590246510135740250";
  6.     char a1[] = "46376937677490009712648124896970078050417018260538";
  7.     char a2[] = "74324986199524741059474233309513058123726617309629";
  8.     char a3[] = "91942213363574161572522430563301811072406154908250";
  9.     char a4[] = "23067588207539346171171980310421047513778063246676";
  10.     char a5[] = "89261670696623633820136378418383684178734361726757";
  11.     char a6[] = "28112879812849979408065481931592621691275889832738";
  12.     char a7[] = "44274228917432520321923589422876796487670272189318";
  13.     char a8[] = "47451445736001306439091167216856844588711603153276";
  14.     char a9[] = "70386486105843025439939619828917593665686757934951";
  15.     char a10[] = "62176457141856560629502157223196586755079324193331";
  16.     char a11[] = "64906352462741904929101432445813822663347944758178";
  17.     char a12[] = "92575867718337217661963751590579239728245598838407";
  18.     char a13[] = "58203565325359399008402633568948830189458628227828";
  19.     char a14[] = "80181199384826282014278194139940567587151170094390";
  20.     char a15[] = "35398664372827112653829987240784473053190104293586";
  21.     char a16[] = "86515506006295864861532075273371959191420517255829";
  22.     char a17[] = "71693888707715466499115593487603532921714970056938";
  23.     char a18[] = "54370070576826684624621495650076471787294438377604";
  24.     char a19[] = "53282654108756828443191190634694037855217779295145";
  25.     char a20[] = "36123272525000296071075082563815656710885258350721";
  26.     char a21[] = "45876576172410976447339110607218265236877223636045";
  27.     char a22[] = "17423706905851860660448207621209813287860733969412";
  28.     char a23[] = "81142660418086830619328460811191061556940512689692";
  29.     char a24[] = "51934325451728388641918047049293215058642563049483";
  30.     char a25[] = "62467221648435076201727918039944693004732956340691";
  31.     char a26[] = "15732444386908125794514089057706229429197107928209";
  32.     char a27[] = "55037687525678773091862540744969844508330393682126";
  33.     char a28[] = "18336384825330154686196124348767681297534375946515";
  34.     char a29[] = "80386287592878490201521685554828717201219257766954";
  35.     char a30[] = "78182833757993103614740356856449095527097864797581";
  36.     char a31[] = "16726320100436897842553539920931837441497806860984";
  37.     char a32[] = "48403098129077791799088218795327364475675590848030";
  38.     char a33[] = "87086987551392711854517078544161852424320693150332";
  39.     char a34[] = "59959406895756536782107074926966537676326235447210";
  40.     char a35[] = "69793950679652694742597709739166693763042633987085";
  41.     char a36[] = "41052684708299085211399427365734116182760315001271";
  42.     char a37[] = "65378607361501080857009149939512557028198746004375";
  43.     char a38[] = "35829035317434717326932123578154982629742552737307";
  44.     char a39[] = "94953759765105305946966067683156574377167401875275";
  45.     char a40[] = "88902802571733229619176668713819931811048770190271";
  46.     char a41[] = "25267680276078003013678680992525463401061632866526";
  47.     char a42[] = "36270218540497705585629946580636237993140746255962";
  48.     char a43[] = "24074486908231174977792365466257246923322810917141";
  49.     char a44[] = "91430288197103288597806669760892938638285025333403";
  50.     char a45[] = "34413065578016127815921815005561868836468420090470";
  51.     char a46[] = "23053081172816430487623791969842487255036638784583";
  52.     char a47[] = "11487696932154902810424020138335124462181441773470";
  53.     char a48[] = "63783299490636259666498587618221225225512486764533";
  54.     char a49[] = "67720186971698544312419572409913959008952310058822";
  55.     char a50[] = "95548255300263520781532296796249481641953868218774";
  56.     char a51[] = "76085327132285723110424803456124867697064507995236";
  57.     char a52[] = "37774242535411291684276865538926205024910326572967";
  58.     char a53[] = "23701913275725675285653248258265463092207058596522";
  59.     char a54[] = "29798860272258331913126375147341994889534765745501";
  60.     char a55[] = "18495701454879288984856827726077713721403798879715";
  61.     char a56[] = "38298203783031473527721580348144513491373226651381";
  62.     char a57[] = "34829543829199918180278916522431027392251122869539";
  63.     char a58[] = "40957953066405232632538044100059654939159879593635";
  64.     char a59[] = "29746152185502371307642255121183693803580388584903";
  65.     char a60[] = "41698116222072977186158236678424689157993532961922";
  66.     char a61[] = "62467957194401269043877107275048102390895523597457";
  67.     char a62[] = "23189706772547915061505504953922979530901129967519";
  68.     char a63[] = "86188088225875314529584099251203829009407770775672";
  69.     char a64[] = "11306739708304724483816533873502340845647058077308";
  70.     char a65[] = "82959174767140363198008187129011875491310547126581";
  71.     char a66[] = "97623331044818386269515456334926366572897563400500";
  72.     char a67[] = "42846280183517070527831839425882145521227251250327";
  73.     char a68[] = "55121603546981200581762165212827652751691296897789";
  74.     char a69[] = "32238195734329339946437501907836945765883352399886";
  75.     char a70[] = "75506164965184775180738168837861091527357929701337";
  76.     char a71[] = "62177842752192623401942399639168044983993173312731";
  77.     char a72[] = "32924185707147349566916674687634660915035914677504";
  78.     char a73[] = "99518671430235219628894890102423325116913619626622";
  79.     char a74[] = "73267460800591547471830798392868535206946944540724";
  80.     char a75[] = "76841822524674417161514036427982273348055556214818";
  81.     char a76[] = "97142617910342598647204516893989422179826088076852";
  82.     char a77[] = "87783646182799346313767754307809363333018982642090";
  83.     char a78[] = "10848802521674670883215120185883543223812876952786";
  84.     char a79[] = "71329612474782464538636993009049310363619763878039";
  85.     char a80[] = "62184073572399794223406235393808339651327408011116";
  86.     char a81[] = "66627891981488087797941876876144230030984490851411";
  87.     char a82[] = "60661826293682836764744779239180335110989069790714";
  88.     char a83[] = "85786944089552990653640447425576083659976645795096";
  89.     char a84[] = "66024396409905389607120198219976047599490197230297";
  90.     char a85[] = "64913982680032973156037120041377903785566085089252";
  91.     char a86[] = "16730939319872750275468906903707539413042652315011";
  92.     char a87[] = "94809377245048795150954100921645863754710598436791";
  93.     char a88[] = "78639167021187492431995700641917969777599028300699";
  94.     char a89[] = "15368713711936614952811305876380278410754449733078";
  95.     char a90[] = "40789923115535562561142322423255033685442488917353";
  96.     char a91[] = "44889911501440648020369068063960672322193204149535";
  97.     char a92[] = "41503128880339536053299340368006977710650566631954";
  98.     char a93[] = "81234880673210146739058568557934581403627822703280";
  99.     char a94[] = "82616570773948327592232845941706525094512325230608";
  100.     char a95[] = "22918802058777319719839450180888072429661980811197";
  101.     char a96[] = "77158542502016545090413245809786882778948721859617";
  102.     char a97[] = "72107838435069186155435662884062257473692284509516";
  103.     char a98[] = "20849603980134001723930671666823555245252804609722";
  104.     char a99[] = "53503534226472524250874054075591789781264330331690";
  105.     int i,j=0,a,o=0;
  106.     char b[10],c[10];
  107.    
  108.     FILE *fp;

  109.     for(i=49;i>0;i--)
  110.     {
  111.         
  112.         a = a0[i] + a1[i] + a2[i] + a3[i] + a4[i] + a5[i] + a6[i] + a7[i] + a8[i] + a9[i] + a10[i] + a11[i] + a12[i] + a13[i] + a14[i] + a15[i] + a16[i] + a17[i] + a18[i] + a19[i] + a20[i] + a21[i] + a22[i] + a23[i] + a24[i] + a25[i] + a26[i] + a27[i] + a28[i] + a29[i] + a30[i] + a31[i] + a32[i] + a33[i] + a34[i] + a35[i] + a36[i] + a37[i] + a38[i] + a39[i] + a40[i] + a41[i] + a42[i] + a43[i] + a44[i] + a45[i] + a46[i] + a47[i] + a48[i] + a49[i] + a50[i] + a51[i] + a52[i] + a53[i] + a54[i] + a55[i] + a56[i] + a57[i] + a58[i] + a59[i] + a60[i] + a61[i] + a62[i] + a63[i] + a64[i] + a65[i] + a66[i] + a67[i] + a68[i] + a69[i] + a70[i] + a71[i] + a72[i] + a73[i] + a74[i] + a75[i] + a76[i] + a77[i] + a78[i] + a79[i] + a80[i] + a81[i] + a82[i] + a83[i] + a84[i] + a85[i] + a86[i] + a87[i] + a88[i] + a89[i] + a90[i] + a91[i] + a92[i] + a93[i] + a94[i] + a95[i] + a96[i] + a97[i] + a98[i] + a99[i] - 100 * '0' + j;
  113.         j = a / 10;
  114.         a = a % 10;

  115.         if(o==0)
  116.         {
  117.         fp = fopen("1.txt","wt");
  118.         itoa(a,c,10);
  119.         fputs(c,fp);
  120.         o++;
  121.         }
  122.         else
  123.         {
  124.         fp = fopen("1.txt","rt");
  125.         itoa(a,c,10);
  126.         fgets(b,10,fp);
  127.         fp = fopen("1.txt","wt");
  128.         fputs(c,fp);
  129.         fputs(b,fp);
  130.         }
  131.         fclose(fp);
  132.      }

  133.         a = a0[0] + a1[0] + a2[0] + a3[0] + a4[0] + a5[0] + a6[0] + a7[0] + a8[0] + a9[0] + a10[0] + a11[0] + a12[0] + a13[0] + a14[0] + a15[0] + a16[0] + a17[0] + a18[0] + a19[0] + a20[0] + a21[0] + a22[0] + a23[0] + a24[0] + a25[0] + a26[0] + a27[0] + a28[0] + a29[0] + a30[0] + a31[0] + a32[0] + a33[0] + a34[0] + a35[0] + a36[0] + a37[0] + a38[0] + a39[0] + a40[0] + a41[0] + a42[0] + a43[0] + a44[0] + a45[0] + a46[0] + a47[0] + a48[0] + a49[0] + a50[0] + a51[0] + a52[0] + a53[0] + a54[0] + a55[0] + a56[0] + a57[0] + a58[0] + a59[0] + a60[0] + a61[0] + a62[0] + a63[0] + a64[0] + a65[0] + a66[0] + a67[0] + a68[0] + a69[0] + a70[0] + a71[0] + a72[0] + a73[0] + a74[0] + a75[0] + a76[0] + a77[0] + a78[0] + a79[0] + a80[0] + a81[0] + a82[0] + a83[0] + a84[0] + a85[0] + a86[0] + a87[0] + a88[0] + a89[0] + a90[0] + a91[0] + a92[0] + a93[0] + a94[0] + a95[0] + a96[0] + a97[0] + a98[0] + a99[0] - 100 * '0' + j;

  134.         fp = fopen("1.txt","rt");
  135.         itoa(a,c,10);
  136.         fgets(b,8,fp);
  137.         fp = fopen("1.txt","wt");
  138.         fputs(c,fp);
  139.         fputs(b,fp);
  140.       
  141.         fclose(fp);
  142.    
  143.     fp = fopen("1.txt","rt");
  144.     fgets(b,11,fp);
  145.     printf("100 个 50 位数之和的前十位数字是%s\n",b);

  146.     system("pause");
  147. }
复制代码


如果有错误希望指出
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 1 反对 0

使用道具 举报

发表于 2016-6-13 18:28:26 | 显示全部楼层
  1. shuru='''37107287533902102798797998220837590246510135740250
  2. 46376937677490009712648124896970078050417018260538
  3. 74324986199524741059474233309513058123726617309629
  4. 91942213363574161572522430563301811072406154908250
  5. 23067588207539346171171980310421047513778063246676
  6. 89261670696623633820136378418383684178734361726757
  7. 28112879812849979408065481931592621691275889832738
  8. 44274228917432520321923589422876796487670272189318
  9. 47451445736001306439091167216856844588711603153276
  10. 70386486105843025439939619828917593665686757934951
  11. 62176457141856560629502157223196586755079324193331
  12. 64906352462741904929101432445813822663347944758178
  13. 92575867718337217661963751590579239728245598838407
  14. 58203565325359399008402633568948830189458628227828
  15. 80181199384826282014278194139940567587151170094390
  16. 35398664372827112653829987240784473053190104293586
  17. 86515506006295864861532075273371959191420517255829
  18. 71693888707715466499115593487603532921714970056938
  19. 54370070576826684624621495650076471787294438377604
  20. 53282654108756828443191190634694037855217779295145
  21. 36123272525000296071075082563815656710885258350721
  22. 45876576172410976447339110607218265236877223636045
  23. 17423706905851860660448207621209813287860733969412
  24. 81142660418086830619328460811191061556940512689692
  25. 51934325451728388641918047049293215058642563049483
  26. 62467221648435076201727918039944693004732956340691
  27. 15732444386908125794514089057706229429197107928209
  28. 55037687525678773091862540744969844508330393682126
  29. 18336384825330154686196124348767681297534375946515
  30. 80386287592878490201521685554828717201219257766954
  31. 78182833757993103614740356856449095527097864797581
  32. 16726320100436897842553539920931837441497806860984
  33. 48403098129077791799088218795327364475675590848030
  34. 87086987551392711854517078544161852424320693150332
  35. 59959406895756536782107074926966537676326235447210
  36. 69793950679652694742597709739166693763042633987085
  37. 41052684708299085211399427365734116182760315001271
  38. 65378607361501080857009149939512557028198746004375
  39. 35829035317434717326932123578154982629742552737307
  40. 94953759765105305946966067683156574377167401875275
  41. 88902802571733229619176668713819931811048770190271
  42. 25267680276078003013678680992525463401061632866526
  43. 36270218540497705585629946580636237993140746255962
  44. 24074486908231174977792365466257246923322810917141
  45. 91430288197103288597806669760892938638285025333403
  46. 34413065578016127815921815005561868836468420090470
  47. 23053081172816430487623791969842487255036638784583
  48. 11487696932154902810424020138335124462181441773470
  49. 63783299490636259666498587618221225225512486764533
  50. 67720186971698544312419572409913959008952310058822
  51. 95548255300263520781532296796249481641953868218774
  52. 76085327132285723110424803456124867697064507995236
  53. 37774242535411291684276865538926205024910326572967
  54. 23701913275725675285653248258265463092207058596522
  55. 29798860272258331913126375147341994889534765745501
  56. 18495701454879288984856827726077713721403798879715
  57. 38298203783031473527721580348144513491373226651381
  58. 34829543829199918180278916522431027392251122869539
  59. 40957953066405232632538044100059654939159879593635
  60. 29746152185502371307642255121183693803580388584903
  61. 41698116222072977186158236678424689157993532961922
  62. 62467957194401269043877107275048102390895523597457
  63. 23189706772547915061505504953922979530901129967519
  64. 86188088225875314529584099251203829009407770775672
  65. 11306739708304724483816533873502340845647058077308
  66. 82959174767140363198008187129011875491310547126581
  67. 97623331044818386269515456334926366572897563400500
  68. 42846280183517070527831839425882145521227251250327
  69. 55121603546981200581762165212827652751691296897789
  70. 32238195734329339946437501907836945765883352399886
  71. 75506164965184775180738168837861091527357929701337
  72. 62177842752192623401942399639168044983993173312731
  73. 32924185707147349566916674687634660915035914677504
  74. 99518671430235219628894890102423325116913619626622
  75. 73267460800591547471830798392868535206946944540724
  76. 76841822524674417161514036427982273348055556214818
  77. 97142617910342598647204516893989422179826088076852
  78. 87783646182799346313767754307809363333018982642090
  79. 10848802521674670883215120185883543223812876952786
  80. 71329612474782464538636993009049310363619763878039
  81. 62184073572399794223406235393808339651327408011116
  82. 66627891981488087797941876876144230030984490851411
  83. 60661826293682836764744779239180335110989069790714
  84. 85786944089552990653640447425576083659976645795096
  85. 66024396409905389607120198219976047599490197230297
  86. 64913982680032973156037120041377903785566085089252
  87. 16730939319872750275468906903707539413042652315011
  88. 94809377245048795150954100921645863754710598436791
  89. 78639167021187492431995700641917969777599028300699
  90. 15368713711936614952811305876380278410754449733078
  91. 40789923115535562561142322423255033685442488917353
  92. 44889911501440648020369068063960672322193204149535
  93. 41503128880339536053299340368006977710650566631954
  94. 81234880673210146739058568557934581403627822703280
  95. 82616570773948327592232845941706525094512325230608
  96. 22918802058777319719839450180888072429661980811197
  97. 77158542502016545090413245809786882778948721859617
  98. 72107838435069186155435662884062257473692284509516
  99. 20849603980134001723930671666823555245252804609722
  100. 53503534226472524250874054075591789781264330331690'''
  101. list1=shuru.split('\n')
  102. sum1=1
  103. for i in range(0,100):
  104.     sum1+=int(list1[i])
  105. list2=list(str(sum1))
  106. list2.reverse()
  107. for i in range(10):
  108.     print(int(list2.pop()),end="")
复制代码

5537376230
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2016-8-15 13:35:32 | 显示全部楼层
运行答案是4494666603

  1. #include<stdio.h>
  2. #include<math.h>

  3. char *s[100]={"37107287533902102798797998220837590246510135740250",
  4. "46376937677490009712648124896970078050417018260538",
  5. "74324986199524741059474233309513058123726617309629",
  6. "91942213363574161572522430563301811072406154908250",
  7. "23067588207539346171171980310421047513778063246676",
  8. "89261670696623633820136378418383684178734361726757",
  9. "28112879812849979408065481931592621691275889832738",
  10. "44274228917432520321923589422876796487670272189318",
  11. "47451445736001306439091167216856844588711603153276",
  12. "70386486105843025439939619828917593665686757934951",
  13. "62176457141856560629502157223196586755079324193331",
  14. "64906352462741904929101432445813822663347944758178",
  15. "92575867718337217661963751590579239728245598838407",
  16. "58203565325359399008402633568948830189458628227828",
  17. "80181199384826282014278194139940567587151170094390",
  18. "35398664372827112653829987240784473053190104293586",
  19. "86515506006295864861532075273371959191420517255829",
  20. "71693888707715466499115593487603532921714970056938",
  21. "54370070576826684624621495650076471787294438377604",
  22. "53282654108756828443191190634694037855217779295145",
  23. "36123272525000296071075082563815656710885258350721",
  24. "45876576172410976447339110607218265236877223636045",
  25. "17423706905851860660448207621209813287860733969412",
  26. "81142660418086830619328460811191061556940512689692",
  27. "51934325451728388641918047049293215058642563049483",
  28. "62467221648435076201727918039944693004732956340691",
  29. "15732444386908125794514089057706229429197107928209",
  30. "55037687525678773091862540744969844508330393682126",
  31. "18336384825330154686196124348767681297534375946515",
  32. "80386287592878490201521685554828717201219257766954",
  33. "78182833757993103614740356856449095527097864797581",
  34. "16726320100436897842553539920931837441497806860984",
  35. "48403098129077791799088218795327364475675590848030",
  36. "87086987551392711854517078544161852424320693150332",
  37. "59959406895756536782107074926966537676326235447210",
  38. "69793950679652694742597709739166693763042633987085",
  39. "41052684708299085211399427365734116182760315001271",
  40. "65378607361501080857009149939512557028198746004375",
  41. "35829035317434717326932123578154982629742552737307",
  42. "94953759765105305946966067683156574377167401875275",
  43. "88902802571733229619176668713819931811048770190271",
  44. "25267680276078003013678680992525463401061632866526",
  45. "36270218540497705585629946580636237993140746255962",
  46. "24074486908231174977792365466257246923322810917141",
  47. "91430288197103288597806669760892938638285025333403",
  48. "34413065578016127815921815005561868836468420090470",
  49. "23053081172816430487623791969842487255036638784583",
  50. "11487696932154902810424020138335124462181441773470",
  51. "63783299490636259666498587618221225225512486764533",
  52. "67720186971698544312419572409913959008952310058822",
  53. "95548255300263520781532296796249481641953868218774",
  54. "76085327132285723110424803456124867697064507995236",
  55. "37774242535411291684276865538926205024910326572967",
  56. "23701913275725675285653248258265463092207058596522",
  57. "29798860272258331913126375147341994889534765745501",
  58. "18495701454879288984856827726077713721403798879715",
  59. "38298203783031473527721580348144513491373226651381",
  60. "34829543829199918180278916522431027392251122869539",
  61. "40957953066405232632538044100059654939159879593635",
  62. "29746152185502371307642255121183693803580388584903",
  63. "41698116222072977186158236678424689157993532961922",
  64. "62467957194401269043877107275048102390895523597457",
  65. "23189706772547915061505504953922979530901129967519",
  66. "86188088225875314529584099251203829009407770775672",
  67. "11306739708304724483816533873502340845647058077308",
  68. "82959174767140363198008187129011875491310547126581",
  69. "97623331044818386269515456334926366572897563400500",
  70. "42846280183517070527831839425882145521227251250327",
  71. "55121603546981200581762165212827652751691296897789",
  72. "32238195734329339946437501907836945765883352399886",
  73. "75506164965184775180738168837861091527357929701337",
  74. "62177842752192623401942399639168044983993173312731",
  75. "32924185707147349566916674687634660915035914677504",
  76. "99518671430235219628894890102423325116913619626622",
  77. "73267460800591547471830798392868535206946944540724",
  78. "76841822524674417161514036427982273348055556214818",
  79. "97142617910342598647204516893989422179826088076852",
  80. "87783646182799346313767754307809363333018982642090",
  81. "10848802521674670883215120185883543223812876952786",
  82. "71329612474782464538636993009049310363619763878039",
  83. "62184073572399794223406235393808339651327408011116",
  84. "66627891981488087797941876876144230030984490851411",
  85. "60661826293682836764744779239180335110989069790714",
  86. "85786944089552990653640447425576083659976645795096",
  87. "66024396409905389607120198219976047599490197230297",
  88. "64913982680032973156037120041377903785566085089252",
  89. "16730939319872750275468906903707539413042652315011",
  90. "94809377245048795150954100921645863754710598436791",
  91. "78639167021187492431995700641917969777599028300699",
  92. "15368713711936614952811305876380278410754449733078",
  93. "40789923115535562561142322423255033685442488917353",
  94. "44889911501440648020369068063960672322193204149535",
  95. "41503128880339536053299340368006977710650566631954",
  96. "81234880673210146739058568557934581403627822703280",
  97. "82616570773948327592232845941706525094512325230608",
  98. "22918802058777319719839450180888072429661980811197",
  99. "77158542502016545090413245809786882778948721859617",
  100. "72107838435069186155435662884062257473692284509516",
  101. "20849603980134001723930671666823555245252804609722"};



  102. void main()
  103. {
  104. int ToInt(char t);
  105. int num[10],a=0,i,j,k=0,sum=0;
  106. for(i=0;i<50;i++,sum=0)
  107. {
  108.        
  109. for(j=0;j<100;j++)
  110.         sum=ToInt(*(*(s+i)+j))+sum;
  111. sum=sum+a;
  112. a=sum/10;
  113. if(i>=40)
  114. {
  115. num[k]=sum%10;
  116. k++;
  117. }
  118. }
  119. if(a>=10)  printf("the number was %d%d%d%d%d%d%d%d%d\n",a,num[7],num[6],num[5],num[4],num[3],num[2],num[1],num[0]);
  120. else if(a>=1&&a<10) printf("the number was %d%d%d%d%d%d%d%d%d%d\n",a,num[8],num[7],num[6],num[5],num[4],num[3],num[2],num[1],num[0]);
  121. else  printf("the number was %d%d%d%d%d%d%d%d%d%d\n",num[9],num[8],num[7],num[6],num[5],num[4],num[3],num[2],num[1],num[0]);
  122. }

  123. int ToInt(char t)
  124. {
  125. if(t>='0'&&t<='9')
  126. return t-48;
  127. else return t;
  128. }

复制代码
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2016-8-26 23:40:43 | 显示全部楼层
  1. shuru='''37107287533902102798797998220837590246510135740250
  2. 46376937677490009712648124896970078050417018260538
  3. 74324986199524741059474233309513058123726617309629
  4. 91942213363574161572522430563301811072406154908250
  5. 23067588207539346171171980310421047513778063246676
  6. 89261670696623633820136378418383684178734361726757
  7. 28112879812849979408065481931592621691275889832738
  8. 44274228917432520321923589422876796487670272189318
  9. 47451445736001306439091167216856844588711603153276
  10. 70386486105843025439939619828917593665686757934951
  11. 62176457141856560629502157223196586755079324193331
  12. 64906352462741904929101432445813822663347944758178
  13. 92575867718337217661963751590579239728245598838407
  14. 58203565325359399008402633568948830189458628227828
  15. 80181199384826282014278194139940567587151170094390
  16. 35398664372827112653829987240784473053190104293586
  17. 86515506006295864861532075273371959191420517255829
  18. 71693888707715466499115593487603532921714970056938
  19. 54370070576826684624621495650076471787294438377604
  20. 53282654108756828443191190634694037855217779295145
  21. 36123272525000296071075082563815656710885258350721
  22. 45876576172410976447339110607218265236877223636045
  23. 17423706905851860660448207621209813287860733969412
  24. 81142660418086830619328460811191061556940512689692
  25. 51934325451728388641918047049293215058642563049483
  26. 62467221648435076201727918039944693004732956340691
  27. 15732444386908125794514089057706229429197107928209
  28. 55037687525678773091862540744969844508330393682126
  29. 18336384825330154686196124348767681297534375946515
  30. 80386287592878490201521685554828717201219257766954
  31. 78182833757993103614740356856449095527097864797581
  32. 16726320100436897842553539920931837441497806860984
  33. 48403098129077791799088218795327364475675590848030
  34. 87086987551392711854517078544161852424320693150332
  35. 59959406895756536782107074926966537676326235447210
  36. 69793950679652694742597709739166693763042633987085
  37. 41052684708299085211399427365734116182760315001271
  38. 65378607361501080857009149939512557028198746004375
  39. 35829035317434717326932123578154982629742552737307
  40. 94953759765105305946966067683156574377167401875275
  41. 88902802571733229619176668713819931811048770190271
  42. 25267680276078003013678680992525463401061632866526
  43. 36270218540497705585629946580636237993140746255962
  44. 24074486908231174977792365466257246923322810917141
  45. 91430288197103288597806669760892938638285025333403
  46. 34413065578016127815921815005561868836468420090470
  47. 23053081172816430487623791969842487255036638784583
  48. 11487696932154902810424020138335124462181441773470
  49. 63783299490636259666498587618221225225512486764533
  50. 67720186971698544312419572409913959008952310058822
  51. 95548255300263520781532296796249481641953868218774
  52. 76085327132285723110424803456124867697064507995236
  53. 37774242535411291684276865538926205024910326572967
  54. 23701913275725675285653248258265463092207058596522
  55. 29798860272258331913126375147341994889534765745501
  56. 18495701454879288984856827726077713721403798879715
  57. 38298203783031473527721580348144513491373226651381
  58. 34829543829199918180278916522431027392251122869539
  59. 40957953066405232632538044100059654939159879593635
  60. 29746152185502371307642255121183693803580388584903
  61. 41698116222072977186158236678424689157993532961922
  62. 62467957194401269043877107275048102390895523597457
  63. 23189706772547915061505504953922979530901129967519
  64. 86188088225875314529584099251203829009407770775672
  65. 11306739708304724483816533873502340845647058077308
  66. 82959174767140363198008187129011875491310547126581
  67. 97623331044818386269515456334926366572897563400500
  68. 42846280183517070527831839425882145521227251250327
  69. 55121603546981200581762165212827652751691296897789
  70. 32238195734329339946437501907836945765883352399886
  71. 75506164965184775180738168837861091527357929701337
  72. 62177842752192623401942399639168044983993173312731
  73. 32924185707147349566916674687634660915035914677504
  74. 99518671430235219628894890102423325116913619626622
  75. 73267460800591547471830798392868535206946944540724
  76. 76841822524674417161514036427982273348055556214818
  77. 97142617910342598647204516893989422179826088076852
  78. 87783646182799346313767754307809363333018982642090
  79. 10848802521674670883215120185883543223812876952786
  80. 71329612474782464538636993009049310363619763878039
  81. 62184073572399794223406235393808339651327408011116
  82. 66627891981488087797941876876144230030984490851411
  83. 60661826293682836764744779239180335110989069790714
  84. 85786944089552990653640447425576083659976645795096
  85. 66024396409905389607120198219976047599490197230297
  86. 64913982680032973156037120041377903785566085089252
  87. 16730939319872750275468906903707539413042652315011
  88. 94809377245048795150954100921645863754710598436791
  89. 78639167021187492431995700641917969777599028300699
  90. 15368713711936614952811305876380278410754449733078
  91. 40789923115535562561142322423255033685442488917353
  92. 44889911501440648020369068063960672322193204149535
  93. 41503128880339536053299340368006977710650566631954
  94. 81234880673210146739058568557934581403627822703280
  95. 82616570773948327592232845941706525094512325230608
  96. 22918802058777319719839450180888072429661980811197
  97. 77158542502016545090413245809786882778948721859617
  98. 72107838435069186155435662884062257473692284509516
  99. 20849603980134001723930671666823555245252804609722
  100. 53503534226472524250874054075591789781264330331690'''
  101. temp = shuru.split('\n',100)
  102. for i in range(100):
  103.     temp[i] = int(temp[i])
  104. b = sum(temp)
  105. a = str(b)[0:10]
复制代码
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2016-9-17 17:57:35 | 显示全部楼层
  1. 944806052671452128077496559065548707261140280441631
  2. [Finished in 0.4s]
复制代码

  1. # Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.
  2. list100 = [
  3. 37107287533902102798797998220837590246510135740250,
  4. 46376937677490009712648124896970078050417018260538,
  5. 74324986199524741059474233309513058123726617309629,
  6. 91942213363574161572522430563301811072406154908250,
  7. 23067588207539346171171980310421047513778063246676,
  8. 89261670696623633820136378418383684178734361726757,
  9. 28112879812849979408065481931592621691275889832738,
  10. 44274228917432520321923589422876796487670272189318,
  11. 47451445736001306439091167216856844588711603153276,
  12. 70386486105843025439939619828917593665686757934951,
  13. 62176457141856560629502157223196586755079324193331,
  14. 64906352462741904929101432445813822663347944758178,
  15. 92575867718337217661963751590579239728245598838407,
  16. 58203565325359399008402633568948830189458628227828,
  17. 80181199384826282014278194139940567587151170094390,
  18. 35398664372827112653829987240784473053190104293586,
  19. 86515506006295864861532075273371959191420517255829,
  20. 71693888707715466499115593487603532921714970056938,
  21. 54370070576826684624621495650076471787294438377604,
  22. 53282654108756828443191190634694037855217779295145,
  23. 36123272525000296071075082563815656710885258350721,
  24. 45876576172410976447339110607218265236877223636045,
  25. 17423706905851860660448207621209813287860733969412,
  26. 81142660418086830619328460811191061556940512689692,
  27. 51934325451728388641918047049293215058642563049483,
  28. 62467221648435076201727918039944693004732956340691,
  29. 15732444386908125794514089057706229429197107928209,
  30. 55037687525678773091862540744969844508330393682126,
  31. 18336384825330154686196124348767681297534375946515,
  32. 80386287592878490201521685554828717201219257766954,
  33. 78182833757993103614740356856449095527097864797581,
  34. 16726320100436897842553539920931837441497806860984,
  35. 48403098129077791799088218795327364475675590848030,
  36. 87086987551392711854517078544161852424320693150332,
  37. 59959406895756536782107074926966537676326235447210,
  38. 69793950679652694742597709739166693763042633987085,
  39. 41052684708299085211399427365734116182760315001271,
  40. 65378607361501080857009149939512557028198746004375,
  41. 35829035317434717326932123578154982629742552737307,
  42. 94953759765105305946966067683156574377167401875275,
  43. 88902802571733229619176668713819931811048770190271,
  44. 25267680276078003013678680992525463401061632866526,
  45. 36270218540497705585629946580636237993140746255962,
  46. 24074486908231174977792365466257246923322810917141,
  47. 91430288197103288597806669760892938638285025333403,
  48. 34413065578016127815921815005561868836468420090470,
  49. 23053081172816430487623791969842487255036638784583,
  50. 11487696932154902810424020138335124462181441773470,
  51. 63783299490636259666498587618221225225512486764533,
  52. 67720186971698544312419572409913959008952310058822,
  53. 95548255300263520781532296796249481641953868218774,
  54. 76085327132285723110424803456124867697064507995236,
  55. 37774242535411291684276865538926205024910326572967,
  56. 23701913275725675285653248258265463092207058596522,
  57. 29798860272258331913126375147341994889534765745501,
  58. 18495701454879288984856827726077713721403798879715,
  59. 38298203783031473527721580348144513491373226651381,
  60. 34829543829199918180278916522431027392251122869539,
  61. 40957953066405232632538044100059654939159879593635,
  62. 29746152185502371307642255121183693803580388584903,
  63. 41698116222072977186158236678424689157993532961922,
  64. 62467957194401269043877107275048102390895523597457,
  65. 23189706772547915061505504953922979530901129967519,
  66. 86188088225875314529584099251203829009407770775672,
  67. 11306739708304724483816533873502340845647058077308,
  68. 82959174767140363198008187129011875491310547126581,
  69. 97623331044818386269515456334926366572897563400500,
  70. 42846280183517070527831839425882145521227251250327,
  71. 55121603546981200581762165212827652751691296897789,
  72. 32238195734329339946437501907836945765883352399886,
  73. 75506164965184775180738168837861091527357929701337,
  74. 62177842752192623401942399639168044983993173312731,
  75. 32924185707147349566916674687634660915035914677504,
  76. 99518671430235219628894890102423325116913619626622,
  77. 73267460800591547471830798392868535206946944540724,
  78. 76841822524674417161514036427982273348055556214818,
  79. 97142617910342598647204516893989422179826088076852,
  80. 87783646182799346313767754307809363333018982642090,
  81. 10848802521674670883215120185883543223812876952786,
  82. 71329612474782464538636993009049310363619763878039,
  83. 62184073572399794223406235393808339651327408011116,
  84. 66627891981488087797941876876144230030984490851411,
  85. 60661826293682836764744779239180335110989069790714,
  86. 85786944089552990653640447425576083659976645795096,
  87. 66024396409905389607120198219976047599490197230297,
  88. 64913982680032973156037120041377903785566085089252,
  89. 16730939319872750275468906903707539413042652315011,
  90. 94809377245048795150954100921645863754710598436791,
  91. 78639167021187492431995700641917969777599028300699,
  92. 15368713711936614952811305876380278410754449733078,
  93. 40789923115535562561142322423255033685442488917353,
  94. 44889911501440648020369068063960672322193204149535,
  95. 41503128880339536053299340368006977710650566631954,
  96. 81234880673210146739058568557934581403627822703280,
  97. 82616570773948327592232845941706525094512325230608,
  98. 22918802058777319719839450180888072429661980811197,
  99. 77158542502016545090413245809786882778948721859617,
  100. 72107838435069186155435662884062257473692284509516,
  101. 20849603980134001723930671666823555245252804609722,
  102. 53503534226472524250874054075591789781264330331690]

  103. trans = []
  104. trdict = {}
  105. for i in list100:
  106.         trans.append (int(str(i)[:8]))
  107.         trdict[int(str(i)[:8])] = i

  108. for j in range(1,100):
  109.         for k in range(1,100):
  110.                 if trans[k-1] < trans[k]:
  111.                         temp = trans[k-1]
  112.                         trans[k-1] = trans[k]
  113.                         trans[k] = temp
  114. total = 0
  115. for l in range(10):
  116.         total += trdict[trans[l]]
  117. print (total)
复制代码
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2016-11-23 16:09:44 | 显示全部楼层
  1. import time
  2. t = time.clock()

  3. def euler13():
  4.     """
  5.     找出以下100个50位数之和的前十位数字
  6.     """
  7.     numstr='''
  8. 37107287533902102798797998220837590246510135740250
  9. 46376937677490009712648124896970078050417018260538
  10. 74324986199524741059474233309513058123726617309629
  11. 91942213363574161572522430563301811072406154908250
  12. 23067588207539346171171980310421047513778063246676
  13. 89261670696623633820136378418383684178734361726757
  14. 28112879812849979408065481931592621691275889832738
  15. 44274228917432520321923589422876796487670272189318
  16. 47451445736001306439091167216856844588711603153276
  17. 70386486105843025439939619828917593665686757934951
  18. 62176457141856560629502157223196586755079324193331
  19. 64906352462741904929101432445813822663347944758178
  20. 92575867718337217661963751590579239728245598838407
  21. 58203565325359399008402633568948830189458628227828
  22. 80181199384826282014278194139940567587151170094390
  23. 35398664372827112653829987240784473053190104293586
  24. 86515506006295864861532075273371959191420517255829
  25. 71693888707715466499115593487603532921714970056938
  26. 54370070576826684624621495650076471787294438377604
  27. 53282654108756828443191190634694037855217779295145
  28. 36123272525000296071075082563815656710885258350721
  29. 45876576172410976447339110607218265236877223636045
  30. 17423706905851860660448207621209813287860733969412
  31. 81142660418086830619328460811191061556940512689692
  32. 51934325451728388641918047049293215058642563049483
  33. 62467221648435076201727918039944693004732956340691
  34. 15732444386908125794514089057706229429197107928209
  35. 55037687525678773091862540744969844508330393682126
  36. 18336384825330154686196124348767681297534375946515
  37. 80386287592878490201521685554828717201219257766954
  38. 78182833757993103614740356856449095527097864797581
  39. 16726320100436897842553539920931837441497806860984
  40. 48403098129077791799088218795327364475675590848030
  41. 87086987551392711854517078544161852424320693150332
  42. 59959406895756536782107074926966537676326235447210
  43. 69793950679652694742597709739166693763042633987085
  44. 41052684708299085211399427365734116182760315001271
  45. 65378607361501080857009149939512557028198746004375
  46. 35829035317434717326932123578154982629742552737307
  47. 94953759765105305946966067683156574377167401875275
  48. 88902802571733229619176668713819931811048770190271
  49. 25267680276078003013678680992525463401061632866526
  50. 36270218540497705585629946580636237993140746255962
  51. 24074486908231174977792365466257246923322810917141
  52. 91430288197103288597806669760892938638285025333403
  53. 34413065578016127815921815005561868836468420090470
  54. 23053081172816430487623791969842487255036638784583
  55. 11487696932154902810424020138335124462181441773470
  56. 63783299490636259666498587618221225225512486764533
  57. 67720186971698544312419572409913959008952310058822
  58. 95548255300263520781532296796249481641953868218774
  59. 76085327132285723110424803456124867697064507995236
  60. 37774242535411291684276865538926205024910326572967
  61. 23701913275725675285653248258265463092207058596522
  62. 29798860272258331913126375147341994889534765745501
  63. 18495701454879288984856827726077713721403798879715
  64. 38298203783031473527721580348144513491373226651381
  65. 34829543829199918180278916522431027392251122869539
  66. 40957953066405232632538044100059654939159879593635
  67. 29746152185502371307642255121183693803580388584903
  68. 41698116222072977186158236678424689157993532961922
  69. 62467957194401269043877107275048102390895523597457
  70. 23189706772547915061505504953922979530901129967519
  71. 86188088225875314529584099251203829009407770775672
  72. 11306739708304724483816533873502340845647058077308
  73. 82959174767140363198008187129011875491310547126581
  74. 97623331044818386269515456334926366572897563400500
  75. 42846280183517070527831839425882145521227251250327
  76. 55121603546981200581762165212827652751691296897789
  77. 32238195734329339946437501907836945765883352399886
  78. 75506164965184775180738168837861091527357929701337
  79. 62177842752192623401942399639168044983993173312731
  80. 32924185707147349566916674687634660915035914677504
  81. 99518671430235219628894890102423325116913619626622
  82. 73267460800591547471830798392868535206946944540724
  83. 76841822524674417161514036427982273348055556214818
  84. 97142617910342598647204516893989422179826088076852
  85. 87783646182799346313767754307809363333018982642090
  86. 10848802521674670883215120185883543223812876952786
  87. 71329612474782464538636993009049310363619763878039
  88. 62184073572399794223406235393808339651327408011116
  89. 66627891981488087797941876876144230030984490851411
  90. 60661826293682836764744779239180335110989069790714
  91. 85786944089552990653640447425576083659976645795096
  92. 66024396409905389607120198219976047599490197230297
  93. 64913982680032973156037120041377903785566085089252
  94. 16730939319872750275468906903707539413042652315011
  95. 94809377245048795150954100921645863754710598436791
  96. 78639167021187492431995700641917969777599028300699
  97. 15368713711936614952811305876380278410754449733078
  98. 40789923115535562561142322423255033685442488917353
  99. 44889911501440648020369068063960672322193204149535
  100. 41503128880339536053299340368006977710650566631954
  101. 81234880673210146739058568557934581403627822703280
  102. 82616570773948327592232845941706525094512325230608
  103. 22918802058777319719839450180888072429661980811197
  104. 77158542502016545090413245809786882778948721859617
  105. 72107838435069186155435662884062257473692284509516
  106. 20849603980134001723930671666823555245252804609722
  107. 53503534226472524250874054075591789781264330331690
  108. '''
  109.     sumlist = [int(n) for n in numstr.strip().split('\n')]
  110.     result = sum(sumlist)
  111.     return str(result)[:10]
  112. print(euler13(),'--time:{}'.format(time.clock()-t))
复制代码


5537376230 --time:5.038577901902681
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-1-10 09:14:12 | 显示全部楼层
好像直接加就特别快了...

5537376230
cost 0.000 sec
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-1-14 11:56:58 | 显示全部楼层
此代码使用MATLAB编程
Problem13所用时间0.019769秒
Problem13的答案为5537376230
  1. %问题13:找出100个50位数之和的前十位数字
  2. function Output=Problem13(Input)
  3. if nargin==0
  4. Input={'37107287533902102798797998220837590246510135740250',...
  5.        '46376937677490009712648124896970078050417018260538',...
  6.     '74324986199524741059474233309513058123726617309629',...
  7.     '91942213363574161572522430563301811072406154908250',...
  8.     '23067588207539346171171980310421047513778063246676',...
  9.     '89261670696623633820136378418383684178734361726757',...
  10.     '28112879812849979408065481931592621691275889832738',...
  11.     '44274228917432520321923589422876796487670272189318',...
  12.     '47451445736001306439091167216856844588711603153276',...
  13.     '70386486105843025439939619828917593665686757934951',...
  14.     '62176457141856560629502157223196586755079324193331',...
  15.     '64906352462741904929101432445813822663347944758178',...
  16.     '92575867718337217661963751590579239728245598838407',...
  17.     '58203565325359399008402633568948830189458628227828',...
  18.     '80181199384826282014278194139940567587151170094390',...
  19.     '35398664372827112653829987240784473053190104293586',...
  20.     '86515506006295864861532075273371959191420517255829',...
  21.     '71693888707715466499115593487603532921714970056938',...
  22.     '54370070576826684624621495650076471787294438377604',...
  23.     '53282654108756828443191190634694037855217779295145',...
  24.     '36123272525000296071075082563815656710885258350721',...
  25.     '45876576172410976447339110607218265236877223636045',...
  26.     '17423706905851860660448207621209813287860733969412',...
  27.     '81142660418086830619328460811191061556940512689692',...
  28.     '51934325451728388641918047049293215058642563049483',...
  29.     '62467221648435076201727918039944693004732956340691',...
  30.     '15732444386908125794514089057706229429197107928209',...
  31.     '55037687525678773091862540744969844508330393682126',...
  32.     '18336384825330154686196124348767681297534375946515',...
  33.     '80386287592878490201521685554828717201219257766954',...
  34.     '78182833757993103614740356856449095527097864797581',...
  35.     '16726320100436897842553539920931837441497806860984',...
  36.     '48403098129077791799088218795327364475675590848030',...
  37.     '87086987551392711854517078544161852424320693150332',...
  38.     '59959406895756536782107074926966537676326235447210',...
  39.     '69793950679652694742597709739166693763042633987085',...
  40.     '41052684708299085211399427365734116182760315001271',...
  41.     '65378607361501080857009149939512557028198746004375',...
  42.     '35829035317434717326932123578154982629742552737307',...
  43.     '94953759765105305946966067683156574377167401875275',...
  44.     '88902802571733229619176668713819931811048770190271',...
  45.     '25267680276078003013678680992525463401061632866526',...
  46.     '36270218540497705585629946580636237993140746255962',...
  47.     '24074486908231174977792365466257246923322810917141',...
  48.     '91430288197103288597806669760892938638285025333403',...
  49.     '34413065578016127815921815005561868836468420090470',...
  50.     '23053081172816430487623791969842487255036638784583',...
  51.     '11487696932154902810424020138335124462181441773470',...
  52.     '63783299490636259666498587618221225225512486764533',...
  53.     '67720186971698544312419572409913959008952310058822',...
  54.     '95548255300263520781532296796249481641953868218774',...
  55.     '76085327132285723110424803456124867697064507995236',...
  56.     '37774242535411291684276865538926205024910326572967',...
  57.     '23701913275725675285653248258265463092207058596522',...
  58.     '29798860272258331913126375147341994889534765745501',...
  59.     '18495701454879288984856827726077713721403798879715',...
  60.     '38298203783031473527721580348144513491373226651381',...
  61.     '34829543829199918180278916522431027392251122869539',...
  62.     '40957953066405232632538044100059654939159879593635',...
  63.     '29746152185502371307642255121183693803580388584903',...
  64.     '41698116222072977186158236678424689157993532961922',...
  65.     '62467957194401269043877107275048102390895523597457',...
  66.     '23189706772547915061505504953922979530901129967519',...
  67.     '86188088225875314529584099251203829009407770775672',...
  68.     '11306739708304724483816533873502340845647058077308',...
  69.     '82959174767140363198008187129011875491310547126581',...
  70.     '97623331044818386269515456334926366572897563400500',...
  71.     '42846280183517070527831839425882145521227251250327',...
  72.     '55121603546981200581762165212827652751691296897789',...
  73.     '32238195734329339946437501907836945765883352399886',...
  74.     '75506164965184775180738168837861091527357929701337',...
  75.     '62177842752192623401942399639168044983993173312731',...
  76.     '32924185707147349566916674687634660915035914677504',...
  77.     '99518671430235219628894890102423325116913619626622',...
  78.     '73267460800591547471830798392868535206946944540724',...
  79.     '76841822524674417161514036427982273348055556214818',...
  80.     '97142617910342598647204516893989422179826088076852',...
  81.     '87783646182799346313767754307809363333018982642090',...
  82.     '10848802521674670883215120185883543223812876952786',...
  83.     '71329612474782464538636993009049310363619763878039',...
  84.     '62184073572399794223406235393808339651327408011116',...
  85.     '66627891981488087797941876876144230030984490851411',...
  86.     '60661826293682836764744779239180335110989069790714',...
  87.     '85786944089552990653640447425576083659976645795096',...
  88.     '66024396409905389607120198219976047599490197230297',...
  89.     '64913982680032973156037120041377903785566085089252',...
  90.     '16730939319872750275468906903707539413042652315011',...
  91.     '94809377245048795150954100921645863754710598436791',...
  92.     '78639167021187492431995700641917969777599028300699',...
  93.     '15368713711936614952811305876380278410754449733078',...
  94.     '40789923115535562561142322423255033685442488917353',...
  95.     '44889911501440648020369068063960672322193204149535',...
  96.     '41503128880339536053299340368006977710650566631954',...
  97.     '81234880673210146739058568557934581403627822703280',...
  98.     '82616570773948327592232845941706525094512325230608',...
  99.     '22918802058777319719839450180888072429661980811197',...
  100.     '77158542502016545090413245809786882778948721859617',...
  101.     '72107838435069186155435662884062257473692284509516',...
  102.     '20849603980134001723930671666823555245252804609722',...
  103.     '53503534226472524250874054075591789781264330331690'};
  104. end
  105. tic
  106. Start=str2num(Input{1}')';
  107. for ii=2:100
  108.    Next=Vector_Plus(Start,str2num(Input{ii}')');
  109.    Start=Next;
  110. end
  111. Output=num2str(Start(1));
  112. for ii=2:10
  113.     O_Temp=[Output,num2str(Start(ii))];
  114.     Output=O_Temp;
  115. end
  116. toc
  117. disp('此代码使用MATLAB编程')
  118. disp(['Problem13所用时间',num2str(toc),'秒'])
  119. disp(['Problem13的答案为',num2str(Output)])
  120. end
  121. %% 子程序
  122. %此程序实现两个向量的加法
  123. function Output=Vector_Plus(a,b)
  124. if nargin==0
  125.     a=[9 9 9 9 9 9 ];
  126.     b=[2 0];
  127. end
  128. L1=length(a);
  129. L2=length(b);
  130. L=max(L1,L2);
  131. if L1<L2
  132.    Span=L2-L1;
  133.    Newa=[zeros(1,Span),a];
  134.    Newb=b;
  135. elseif L1>L2
  136.    Span=L1-L2;
  137.    Newa=a;
  138.    Newb=[zeros(1,Span),b];
  139. else
  140.     Newa=a;
  141.     Newb=b;
  142. end
  143. Rank=Newa+Newb;
  144. for ii=L:-1:2
  145.     if Rank(ii)>=10
  146.         Rank(ii)=Rank(ii)-10;
  147.         Rank(ii-1)=Rank(ii-1)+1;
  148.     end
  149. end
  150. Biggest=0;
  151. while (Rank(1)>=10)
  152.     if Rank(1)>=10
  153.        Rank(1)=Rank(1)-10;
  154.        Biggest=Biggest+1;
  155.     end
  156. end
  157. if Biggest>0
  158.     Output=[Biggest,Rank];
  159. else
  160.     Output=Rank;
  161. end
  162. end
  163.       
  164.    
复制代码
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-2-7 00:54:24 | 显示全部楼层
  1. import time

  2. def large_sum(number=10):
  3.     '取100个50位数之和的前number位数'
  4.     source = '''
  5.         37107287533902102798797998220837590246510135740250
  6.         46376937677490009712648124896970078050417018260538
  7.         74324986199524741059474233309513058123726617309629
  8.         91942213363574161572522430563301811072406154908250
  9.         23067588207539346171171980310421047513778063246676
  10.         89261670696623633820136378418383684178734361726757
  11.         28112879812849979408065481931592621691275889832738
  12.         44274228917432520321923589422876796487670272189318
  13.         47451445736001306439091167216856844588711603153276
  14.         70386486105843025439939619828917593665686757934951
  15.         62176457141856560629502157223196586755079324193331
  16.         64906352462741904929101432445813822663347944758178
  17.         92575867718337217661963751590579239728245598838407
  18.         58203565325359399008402633568948830189458628227828
  19.         80181199384826282014278194139940567587151170094390
  20.         35398664372827112653829987240784473053190104293586
  21.         86515506006295864861532075273371959191420517255829
  22.         71693888707715466499115593487603532921714970056938
  23.         54370070576826684624621495650076471787294438377604
  24.         53282654108756828443191190634694037855217779295145
  25.         36123272525000296071075082563815656710885258350721
  26.         45876576172410976447339110607218265236877223636045
  27.         17423706905851860660448207621209813287860733969412
  28.         81142660418086830619328460811191061556940512689692
  29.         51934325451728388641918047049293215058642563049483
  30.         62467221648435076201727918039944693004732956340691
  31.         15732444386908125794514089057706229429197107928209
  32.         55037687525678773091862540744969844508330393682126
  33.         18336384825330154686196124348767681297534375946515
  34.         80386287592878490201521685554828717201219257766954
  35.         78182833757993103614740356856449095527097864797581
  36.         16726320100436897842553539920931837441497806860984
  37.         48403098129077791799088218795327364475675590848030
  38.         87086987551392711854517078544161852424320693150332
  39.         59959406895756536782107074926966537676326235447210
  40.         69793950679652694742597709739166693763042633987085
  41.         41052684708299085211399427365734116182760315001271
  42.         65378607361501080857009149939512557028198746004375
  43.         35829035317434717326932123578154982629742552737307
  44.         94953759765105305946966067683156574377167401875275
  45.         88902802571733229619176668713819931811048770190271
  46.         25267680276078003013678680992525463401061632866526
  47.         36270218540497705585629946580636237993140746255962
  48.         24074486908231174977792365466257246923322810917141
  49.         91430288197103288597806669760892938638285025333403
  50.         34413065578016127815921815005561868836468420090470
  51.         23053081172816430487623791969842487255036638784583
  52.         11487696932154902810424020138335124462181441773470
  53.         63783299490636259666498587618221225225512486764533
  54.         67720186971698544312419572409913959008952310058822
  55.         95548255300263520781532296796249481641953868218774
  56.         76085327132285723110424803456124867697064507995236
  57.         37774242535411291684276865538926205024910326572967
  58.         23701913275725675285653248258265463092207058596522
  59.         29798860272258331913126375147341994889534765745501
  60.         18495701454879288984856827726077713721403798879715
  61.         38298203783031473527721580348144513491373226651381
  62.         34829543829199918180278916522431027392251122869539
  63.         40957953066405232632538044100059654939159879593635
  64.         29746152185502371307642255121183693803580388584903
  65.         41698116222072977186158236678424689157993532961922
  66.         62467957194401269043877107275048102390895523597457
  67.         23189706772547915061505504953922979530901129967519
  68.         86188088225875314529584099251203829009407770775672
  69.         11306739708304724483816533873502340845647058077308
  70.         82959174767140363198008187129011875491310547126581
  71.         97623331044818386269515456334926366572897563400500
  72.         42846280183517070527831839425882145521227251250327
  73.         55121603546981200581762165212827652751691296897789
  74.         32238195734329339946437501907836945765883352399886
  75.         75506164965184775180738168837861091527357929701337
  76.         62177842752192623401942399639168044983993173312731
  77.         32924185707147349566916674687634660915035914677504
  78.         99518671430235219628894890102423325116913619626622
  79.         73267460800591547471830798392868535206946944540724
  80.         76841822524674417161514036427982273348055556214818
  81.         97142617910342598647204516893989422179826088076852
  82.         87783646182799346313767754307809363333018982642090
  83.         10848802521674670883215120185883543223812876952786
  84.         71329612474782464538636993009049310363619763878039
  85.         62184073572399794223406235393808339651327408011116
  86.         66627891981488087797941876876144230030984490851411
  87.         60661826293682836764744779239180335110989069790714
  88.         85786944089552990653640447425576083659976645795096
  89.         66024396409905389607120198219976047599490197230297
  90.         64913982680032973156037120041377903785566085089252
  91.         16730939319872750275468906903707539413042652315011
  92.         94809377245048795150954100921645863754710598436791
  93.         78639167021187492431995700641917969777599028300699
  94.         15368713711936614952811305876380278410754449733078
  95.         40789923115535562561142322423255033685442488917353
  96.         44889911501440648020369068063960672322193204149535
  97.         41503128880339536053299340368006977710650566631954
  98.         81234880673210146739058568557934581403627822703280
  99.         82616570773948327592232845941706525094512325230608
  100.         22918802058777319719839450180888072429661980811197
  101.         77158542502016545090413245809786882778948721859617
  102.         72107838435069186155435662884062257473692284509516
  103.         20849603980134001723930671666823555245252804609722
  104.         53503534226472524250874054075591789781264330331690
  105.     '''
  106.     list_source = source.split()
  107.     large_sum = 0
  108.     for i in range(0, 100):
  109.         large_sum += int(list_source[i][0:(number + 2)])
  110.     large_sum = str(large_sum)[0:number]
  111.     return large_sum


  112. start = time.clock()
  113. print(large_sum())
  114. end = time.clock()
  115. print('程序执行了%fs。' %(end - start))
复制代码

执行结果:
5537376230
程序执行了0.000309s。
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-2-28 14:22:37 | 显示全部楼层
本帖最后由 marmot 于 2017-2-28 14:37 编辑
  1. data = """.......数字"""

  2. print('对100个50位数求和,取前10位数')

  3. sum_data_13 = str(sum([int(i[:13]) for i in  data.split()]))[:10]

  4. print('答案是: '+ str(sum_data_13))
复制代码

反正求前10位,总共100个数,只有前13位会对结果可能有影响
取每个的前13位加一起就好了,不用全部取
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-2-28 14:32:43 | 显示全部楼层
本帖最后由 marmot 于 2017-2-28 14:38 编辑

data为原始数据,分布解如下
  1. # 1.列表解析式里split分片
  2. # 2.取前13位,有影响的,换为int
  3. # 3.求和函数sun()
  4. # 4.字符串分片

  5. data_1 = [i for i in data.split()]
  6. data_2 = [int(i[:13]) for i in data_1]
  7. data_3 = sum(data_2)
  8. data_4 = str(data_3)[:10]
复制代码
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-3-14 19:15:22 | 显示全部楼层
  1. str1='''37107287533902102798797998220837590246510135740250
  2. 46376937677490009712648124896970078050417018260538
  3. 74324986199524741059474233309513058123726617309629
  4. 91942213363574161572522430563301811072406154908250
  5. 23067588207539346171171980310421047513778063246676
  6. 89261670696623633820136378418383684178734361726757
  7. 28112879812849979408065481931592621691275889832738
  8. 44274228917432520321923589422876796487670272189318
  9. 47451445736001306439091167216856844588711603153276
  10. 70386486105843025439939619828917593665686757934951
  11. 62176457141856560629502157223196586755079324193331
  12. 64906352462741904929101432445813822663347944758178
  13. 92575867718337217661963751590579239728245598838407
  14. 58203565325359399008402633568948830189458628227828
  15. 80181199384826282014278194139940567587151170094390
  16. 35398664372827112653829987240784473053190104293586
  17. 86515506006295864861532075273371959191420517255829
  18. 71693888707715466499115593487603532921714970056938
  19. 54370070576826684624621495650076471787294438377604
  20. 53282654108756828443191190634694037855217779295145
  21. 36123272525000296071075082563815656710885258350721
  22. 45876576172410976447339110607218265236877223636045
  23. 17423706905851860660448207621209813287860733969412
  24. 81142660418086830619328460811191061556940512689692
  25. 51934325451728388641918047049293215058642563049483
  26. 62467221648435076201727918039944693004732956340691
  27. 15732444386908125794514089057706229429197107928209
  28. 55037687525678773091862540744969844508330393682126
  29. 18336384825330154686196124348767681297534375946515
  30. 80386287592878490201521685554828717201219257766954
  31. 78182833757993103614740356856449095527097864797581
  32. 16726320100436897842553539920931837441497806860984
  33. 48403098129077791799088218795327364475675590848030
  34. 87086987551392711854517078544161852424320693150332
  35. 59959406895756536782107074926966537676326235447210
  36. 69793950679652694742597709739166693763042633987085
  37. 41052684708299085211399427365734116182760315001271
  38. 65378607361501080857009149939512557028198746004375
  39. 35829035317434717326932123578154982629742552737307
  40. 94953759765105305946966067683156574377167401875275
  41. 88902802571733229619176668713819931811048770190271
  42. 25267680276078003013678680992525463401061632866526
  43. 36270218540497705585629946580636237993140746255962
  44. 24074486908231174977792365466257246923322810917141
  45. 91430288197103288597806669760892938638285025333403
  46. 34413065578016127815921815005561868836468420090470
  47. 23053081172816430487623791969842487255036638784583
  48. 11487696932154902810424020138335124462181441773470
  49. 63783299490636259666498587618221225225512486764533
  50. 67720186971698544312419572409913959008952310058822
  51. 95548255300263520781532296796249481641953868218774
  52. 76085327132285723110424803456124867697064507995236
  53. 37774242535411291684276865538926205024910326572967
  54. 23701913275725675285653248258265463092207058596522
  55. 29798860272258331913126375147341994889534765745501
  56. 18495701454879288984856827726077713721403798879715
  57. 38298203783031473527721580348144513491373226651381
  58. 34829543829199918180278916522431027392251122869539
  59. 40957953066405232632538044100059654939159879593635
  60. 29746152185502371307642255121183693803580388584903
  61. 41698116222072977186158236678424689157993532961922
  62. 62467957194401269043877107275048102390895523597457
  63. 23189706772547915061505504953922979530901129967519
  64. 86188088225875314529584099251203829009407770775672
  65. 11306739708304724483816533873502340845647058077308
  66. 82959174767140363198008187129011875491310547126581
  67. 97623331044818386269515456334926366572897563400500
  68. 42846280183517070527831839425882145521227251250327
  69. 55121603546981200581762165212827652751691296897789
  70. 32238195734329339946437501907836945765883352399886
  71. 75506164965184775180738168837861091527357929701337
  72. 62177842752192623401942399639168044983993173312731
  73. 32924185707147349566916674687634660915035914677504
  74. 99518671430235219628894890102423325116913619626622
  75. 73267460800591547471830798392868535206946944540724
  76. 76841822524674417161514036427982273348055556214818
  77. 97142617910342598647204516893989422179826088076852
  78. 87783646182799346313767754307809363333018982642090
  79. 10848802521674670883215120185883543223812876952786
  80. 71329612474782464538636993009049310363619763878039
  81. 62184073572399794223406235393808339651327408011116
  82. 66627891981488087797941876876144230030984490851411
  83. 60661826293682836764744779239180335110989069790714
  84. 85786944089552990653640447425576083659976645795096
  85. 66024396409905389607120198219976047599490197230297
  86. 64913982680032973156037120041377903785566085089252
  87. 16730939319872750275468906903707539413042652315011
  88. 94809377245048795150954100921645863754710598436791
  89. 78639167021187492431995700641917969777599028300699
  90. 15368713711936614952811305876380278410754449733078
  91. 40789923115535562561142322423255033685442488917353
  92. 44889911501440648020369068063960672322193204149535
  93. 41503128880339536053299340368006977710650566631954
  94. 81234880673210146739058568557934581403627822703280
  95. 82616570773948327592232845941706525094512325230608
  96. 22918802058777319719839450180888072429661980811197
  97. 77158542502016545090413245809786882778948721859617
  98. 72107838435069186155435662884062257473692284509516
  99. 20849603980134001723930671666823555245252804609722
  100. 53503534226472524250874054075591789781264330331690'''
  101. list1=str1.split('\n')
  102. sum1=0
  103. for i in range(100):
  104.     sum1+=int(list1[i])
  105. print(str(sum1)[:10])
复制代码

>>>
5537376230
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-4-2 15:31:10 | 显示全部楼层
5537376230
  1. #include <stdio.h>

  2. int main(void)
  3. {
  4.     char numbers[][50] ={
  5.     {"37107287533902102798797998220837590246510135740250"},\
  6.     {"46376937677490009712648124896970078050417018260538"},\
  7.     {"74324986199524741059474233309513058123726617309629"},\
  8.     {"91942213363574161572522430563301811072406154908250"},\
  9.     {"23067588207539346171171980310421047513778063246676"},\
  10.     {"89261670696623633820136378418383684178734361726757"},\
  11.     {"28112879812849979408065481931592621691275889832738"},\
  12.     {"44274228917432520321923589422876796487670272189318"},\
  13.     {"47451445736001306439091167216856844588711603153276"},\
  14.     {"70386486105843025439939619828917593665686757934951"},\
  15.     {"62176457141856560629502157223196586755079324193331"},\
  16.     {"64906352462741904929101432445813822663347944758178"},\
  17.     {"92575867718337217661963751590579239728245598838407"},\
  18.     {"58203565325359399008402633568948830189458628227828"},\
  19.     {"80181199384826282014278194139940567587151170094390"},\
  20.     {"35398664372827112653829987240784473053190104293586"},\
  21.     {"86515506006295864861532075273371959191420517255829"},\
  22.     {"71693888707715466499115593487603532921714970056938"},\
  23.     {"54370070576826684624621495650076471787294438377604"},\
  24.     {"53282654108756828443191190634694037855217779295145"},\
  25.     {"36123272525000296071075082563815656710885258350721"},\
  26.     {"45876576172410976447339110607218265236877223636045"},\
  27.     {"17423706905851860660448207621209813287860733969412"},\
  28.     {"81142660418086830619328460811191061556940512689692"},\
  29.     {"51934325451728388641918047049293215058642563049483"},\
  30.     {"62467221648435076201727918039944693004732956340691"},\
  31.     {"15732444386908125794514089057706229429197107928209"},\
  32.     {"55037687525678773091862540744969844508330393682126"},\
  33.     {"18336384825330154686196124348767681297534375946515"},\
  34.     {"80386287592878490201521685554828717201219257766954"},\
  35.     {"78182833757993103614740356856449095527097864797581"},\
  36.     {"16726320100436897842553539920931837441497806860984"},\
  37.     {"48403098129077791799088218795327364475675590848030"},\
  38.     {"87086987551392711854517078544161852424320693150332"},\
  39.     {"59959406895756536782107074926966537676326235447210"},\
  40.     {"69793950679652694742597709739166693763042633987085"},\
  41.     {"41052684708299085211399427365734116182760315001271"},\
  42.     {"65378607361501080857009149939512557028198746004375"},\
  43.     {"35829035317434717326932123578154982629742552737307"},\
  44.     {"94953759765105305946966067683156574377167401875275"},\
  45.     {"88902802571733229619176668713819931811048770190271"},\
  46.     {"25267680276078003013678680992525463401061632866526"},\
  47.     {"36270218540497705585629946580636237993140746255962"},\
  48.     {"24074486908231174977792365466257246923322810917141"},\
  49.     {"91430288197103288597806669760892938638285025333403"},\
  50.     {"34413065578016127815921815005561868836468420090470"},\
  51.     {"23053081172816430487623791969842487255036638784583"},\
  52.     {"11487696932154902810424020138335124462181441773470"},\
  53.     {"63783299490636259666498587618221225225512486764533"},\
  54.     {"67720186971698544312419572409913959008952310058822"},\
  55.     {"95548255300263520781532296796249481641953868218774"},\
  56.     {"76085327132285723110424803456124867697064507995236"},\
  57.     {"37774242535411291684276865538926205024910326572967"},\
  58.     {"23701913275725675285653248258265463092207058596522"},\
  59.     {"29798860272258331913126375147341994889534765745501"},\
  60.     {"18495701454879288984856827726077713721403798879715"},\
  61.     {"38298203783031473527721580348144513491373226651381"},\
  62.     {"34829543829199918180278916522431027392251122869539"},\
  63.     {"40957953066405232632538044100059654939159879593635"},\
  64.     {"29746152185502371307642255121183693803580388584903"},\
  65.     {"41698116222072977186158236678424689157993532961922"},\
  66.     {"62467957194401269043877107275048102390895523597457"},\
  67.     {"23189706772547915061505504953922979530901129967519"},\
  68.     {"86188088225875314529584099251203829009407770775672"},\
  69.     {"11306739708304724483816533873502340845647058077308"},\
  70.     {"82959174767140363198008187129011875491310547126581"},\
  71.     {"97623331044818386269515456334926366572897563400500"},\
  72.     {"42846280183517070527831839425882145521227251250327"},\
  73.     {"55121603546981200581762165212827652751691296897789"},\
  74.     {"32238195734329339946437501907836945765883352399886"},\
  75.     {"75506164965184775180738168837861091527357929701337"},\
  76.     {"62177842752192623401942399639168044983993173312731"},\
  77.     {"32924185707147349566916674687634660915035914677504"},\
  78.     {"99518671430235219628894890102423325116913619626622"},\
  79.     {"73267460800591547471830798392868535206946944540724"},\
  80.     {"76841822524674417161514036427982273348055556214818"},\
  81.     {"97142617910342598647204516893989422179826088076852"},\
  82.     {"87783646182799346313767754307809363333018982642090"},\
  83.     {"10848802521674670883215120185883543223812876952786"},\
  84.     {"71329612474782464538636993009049310363619763878039"},\
  85.     {"62184073572399794223406235393808339651327408011116"},\
  86.     {"66627891981488087797941876876144230030984490851411"},\
  87.     {"60661826293682836764744779239180335110989069790714"},\
  88.     {"85786944089552990653640447425576083659976645795096"},\
  89.     {"66024396409905389607120198219976047599490197230297"},\
  90.     {"64913982680032973156037120041377903785566085089252"},\
  91.     {"16730939319872750275468906903707539413042652315011"},\
  92.     {"94809377245048795150954100921645863754710598436791"},\
  93.     {"78639167021187492431995700641917969777599028300699"},\
  94.     {"15368713711936614952811305876380278410754449733078"},\
  95.     {"40789923115535562561142322423255033685442488917353"},\
  96.     {"44889911501440648020369068063960672322193204149535"},\
  97.     {"41503128880339536053299340368006977710650566631954"},\
  98.     {"81234880673210146739058568557934581403627822703280"},\
  99.     {"82616570773948327592232845941706525094512325230608"},\
  100.     {"22918802058777319719839450180888072429661980811197"},\
  101.     {"77158542502016545090413245809786882778948721859617"},\
  102.     {"72107838435069186155435662884062257473692284509516"},\
  103.     {"20849603980134001723930671666823555245252804609722"},\
  104.     {"53503534226472524250874054075591789781264330331690"}};

  105.     int result[52] = {0};
  106.     int num = 0;
  107.     int i, j;

  108.     for(j = 49; j >= 0; j--)
  109.     {
  110.         num /= 10;
  111.         for(i = 0; i < 100; i++)
  112.         {
  113.             num += (int)(numbers[i][j] - '0');
  114.         }
  115.         result[j + 2] = num % 10;
  116.     }
  117.     result[1] = num % 100 / 10;
  118.     result[0] = num % 1000 / 100;

  119.     for(i = 0; i < 10; i++)
  120.     {
  121.         printf("%d", result[i]);
  122.     }
  123.     putchar('\n');

  124.     return 0;
  125. }
复制代码
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-4-2 15:53:38 | 显示全部楼层
  1. def main():
  2.     number = [\
  3.     str(37107287533902102798797998220837590246510135740250),\
  4.     str(46376937677490009712648124896970078050417018260538),\
  5.     str(74324986199524741059474233309513058123726617309629),\
  6.     str(91942213363574161572522430563301811072406154908250),\
  7.     str(23067588207539346171171980310421047513778063246676),\
  8.     str(89261670696623633820136378418383684178734361726757),\
  9.     str(28112879812849979408065481931592621691275889832738),\
  10.     str(44274228917432520321923589422876796487670272189318),\
  11.     str(47451445736001306439091167216856844588711603153276),\
  12.     str(70386486105843025439939619828917593665686757934951),\
  13.     str(62176457141856560629502157223196586755079324193331),\
  14.     str(64906352462741904929101432445813822663347944758178),\
  15.     str(92575867718337217661963751590579239728245598838407),\
  16.     str(58203565325359399008402633568948830189458628227828),\
  17.     str(80181199384826282014278194139940567587151170094390),\
  18.     str(35398664372827112653829987240784473053190104293586),\
  19.     str(86515506006295864861532075273371959191420517255829),\
  20.     str(71693888707715466499115593487603532921714970056938),\
  21.     str(54370070576826684624621495650076471787294438377604),\
  22.     str(53282654108756828443191190634694037855217779295145),\
  23.     str(36123272525000296071075082563815656710885258350721),\
  24.     str(45876576172410976447339110607218265236877223636045),\
  25.     str(17423706905851860660448207621209813287860733969412),\
  26.     str(81142660418086830619328460811191061556940512689692),\
  27.     str(51934325451728388641918047049293215058642563049483),\
  28.     str(62467221648435076201727918039944693004732956340691),\
  29.     str(15732444386908125794514089057706229429197107928209),\
  30.     str(55037687525678773091862540744969844508330393682126),\
  31.     str(18336384825330154686196124348767681297534375946515),\
  32.     str(80386287592878490201521685554828717201219257766954),\
  33.     str(78182833757993103614740356856449095527097864797581),\
  34.     str(16726320100436897842553539920931837441497806860984),\
  35.     str(48403098129077791799088218795327364475675590848030),\
  36.     str(87086987551392711854517078544161852424320693150332),\
  37.     str(59959406895756536782107074926966537676326235447210),\
  38.     str(69793950679652694742597709739166693763042633987085),\
  39.     str(41052684708299085211399427365734116182760315001271),\
  40.     str(65378607361501080857009149939512557028198746004375),\
  41.     str(35829035317434717326932123578154982629742552737307),\
  42.     str(94953759765105305946966067683156574377167401875275),\
  43.     str(88902802571733229619176668713819931811048770190271),\
  44.     str(25267680276078003013678680992525463401061632866526),\
  45.     str(36270218540497705585629946580636237993140746255962),\
  46.     str(24074486908231174977792365466257246923322810917141),\
  47.     str(91430288197103288597806669760892938638285025333403),\
  48.     str(34413065578016127815921815005561868836468420090470),\
  49.     str(23053081172816430487623791969842487255036638784583),\
  50.     str(11487696932154902810424020138335124462181441773470),\
  51.     str(63783299490636259666498587618221225225512486764533),\
  52.     str(67720186971698544312419572409913959008952310058822),\
  53.     str(95548255300263520781532296796249481641953868218774),\
  54.     str(76085327132285723110424803456124867697064507995236),\
  55.     str(37774242535411291684276865538926205024910326572967),\
  56.     str(23701913275725675285653248258265463092207058596522),\
  57.     str(29798860272258331913126375147341994889534765745501),\
  58.     str(18495701454879288984856827726077713721403798879715),\
  59.     str(38298203783031473527721580348144513491373226651381),\
  60.     str(34829543829199918180278916522431027392251122869539),\
  61.     str(40957953066405232632538044100059654939159879593635),\
  62.     str(29746152185502371307642255121183693803580388584903),\
  63.     str(41698116222072977186158236678424689157993532961922),\
  64.     str(62467957194401269043877107275048102390895523597457),\
  65.     str(23189706772547915061505504953922979530901129967519),\
  66.     str(86188088225875314529584099251203829009407770775672),\
  67.     str(11306739708304724483816533873502340845647058077308),\
  68.     str(82959174767140363198008187129011875491310547126581),\
  69.     str(97623331044818386269515456334926366572897563400500),\
  70.     str(42846280183517070527831839425882145521227251250327),\
  71.     str(55121603546981200581762165212827652751691296897789),\
  72.     str(32238195734329339946437501907836945765883352399886),\
  73.     str(75506164965184775180738168837861091527357929701337),\
  74.     str(62177842752192623401942399639168044983993173312731),\
  75.     str(32924185707147349566916674687634660915035914677504),\
  76.     str(99518671430235219628894890102423325116913619626622),\
  77.     str(73267460800591547471830798392868535206946944540724),\
  78.     str(76841822524674417161514036427982273348055556214818),\
  79.     str(97142617910342598647204516893989422179826088076852),\
  80.     str(87783646182799346313767754307809363333018982642090),\
  81.     str(10848802521674670883215120185883543223812876952786),\
  82.     str(71329612474782464538636993009049310363619763878039),\
  83.     str(62184073572399794223406235393808339651327408011116),\
  84.     str(66627891981488087797941876876144230030984490851411),\
  85.     str(60661826293682836764744779239180335110989069790714),\
  86.     str(85786944089552990653640447425576083659976645795096),\
  87.     str(66024396409905389607120198219976047599490197230297),\
  88.     str(64913982680032973156037120041377903785566085089252),\
  89.     str(16730939319872750275468906903707539413042652315011),\
  90.     str(94809377245048795150954100921645863754710598436791),\
  91.     str(78639167021187492431995700641917969777599028300699),\
  92.     str(15368713711936614952811305876380278410754449733078),\
  93.     str(40789923115535562561142322423255033685442488917353),\
  94.     str(44889911501440648020369068063960672322193204149535),\
  95.     str(41503128880339536053299340368006977710650566631954),\
  96.     str(81234880673210146739058568557934581403627822703280),\
  97.     str(82616570773948327592232845941706525094512325230608),\
  98.     str(22918802058777319719839450180888072429661980811197),\
  99.     str(77158542502016545090413245809786882778948721859617),\
  100.     str(72107838435069186155435662884062257473692284509516),\
  101.     str(20849603980134001723930671666823555245252804609722),\
  102.     str(53503534226472524250874054075591789781264330331690)]

  103.     result = []
  104.     num = 0

  105.     for j in range(49, -1, -1):
  106.         num //= 10
  107.         for i in range(100):
  108.             num += int(number[i][j])

  109.         result.append(num % 10)

  110.     result.append(num % 100 // 10)
  111.     result.append(num % 1000 // 100)

  112.     for i in range(1, 11):
  113.         print("%d" % result[-i], end = '')
  114.     print("")

  115. if __name__ == "__main__":
  116.     main()
复制代码
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-4-6 23:53:51 | 显示全部楼层
结果:
代码:'5537376230'
  1. num='''37107287533902102798797998220837590246510135740250
  2. 46376937677490009712648124896970078050417018260538
  3. 74324986199524741059474233309513058123726617309629
  4. 91942213363574161572522430563301811072406154908250
  5. 23067588207539346171171980310421047513778063246676
  6. 89261670696623633820136378418383684178734361726757
  7. 28112879812849979408065481931592621691275889832738
  8. 44274228917432520321923589422876796487670272189318
  9. 47451445736001306439091167216856844588711603153276
  10. 70386486105843025439939619828917593665686757934951
  11. 62176457141856560629502157223196586755079324193331
  12. 64906352462741904929101432445813822663347944758178
  13. 92575867718337217661963751590579239728245598838407
  14. 58203565325359399008402633568948830189458628227828
  15. 80181199384826282014278194139940567587151170094390
  16. 35398664372827112653829987240784473053190104293586
  17. 86515506006295864861532075273371959191420517255829
  18. 71693888707715466499115593487603532921714970056938
  19. 54370070576826684624621495650076471787294438377604
  20. 53282654108756828443191190634694037855217779295145
  21. 36123272525000296071075082563815656710885258350721
  22. 45876576172410976447339110607218265236877223636045
  23. 17423706905851860660448207621209813287860733969412
  24. 81142660418086830619328460811191061556940512689692
  25. 51934325451728388641918047049293215058642563049483
  26. 62467221648435076201727918039944693004732956340691
  27. 15732444386908125794514089057706229429197107928209
  28. 55037687525678773091862540744969844508330393682126
  29. 18336384825330154686196124348767681297534375946515
  30. 80386287592878490201521685554828717201219257766954
  31. 78182833757993103614740356856449095527097864797581
  32. 16726320100436897842553539920931837441497806860984
  33. 48403098129077791799088218795327364475675590848030
  34. 87086987551392711854517078544161852424320693150332
  35. 59959406895756536782107074926966537676326235447210
  36. 69793950679652694742597709739166693763042633987085
  37. 41052684708299085211399427365734116182760315001271
  38. 65378607361501080857009149939512557028198746004375
  39. 35829035317434717326932123578154982629742552737307
  40. 94953759765105305946966067683156574377167401875275
  41. 88902802571733229619176668713819931811048770190271
  42. 25267680276078003013678680992525463401061632866526
  43. 36270218540497705585629946580636237993140746255962
  44. 24074486908231174977792365466257246923322810917141
  45. 91430288197103288597806669760892938638285025333403
  46. 34413065578016127815921815005561868836468420090470
  47. 23053081172816430487623791969842487255036638784583
  48. 11487696932154902810424020138335124462181441773470
  49. 63783299490636259666498587618221225225512486764533
  50. 67720186971698544312419572409913959008952310058822
  51. 95548255300263520781532296796249481641953868218774
  52. 76085327132285723110424803456124867697064507995236
  53. 37774242535411291684276865538926205024910326572967
  54. 23701913275725675285653248258265463092207058596522
  55. 29798860272258331913126375147341994889534765745501
  56. 18495701454879288984856827726077713721403798879715
  57. 38298203783031473527721580348144513491373226651381
  58. 34829543829199918180278916522431027392251122869539
  59. 40957953066405232632538044100059654939159879593635
  60. 29746152185502371307642255121183693803580388584903
  61. 41698116222072977186158236678424689157993532961922
  62. 62467957194401269043877107275048102390895523597457
  63. 23189706772547915061505504953922979530901129967519
  64. 86188088225875314529584099251203829009407770775672
  65. 11306739708304724483816533873502340845647058077308
  66. 82959174767140363198008187129011875491310547126581
  67. 97623331044818386269515456334926366572897563400500
  68. 42846280183517070527831839425882145521227251250327
  69. 55121603546981200581762165212827652751691296897789
  70. 32238195734329339946437501907836945765883352399886
  71. 75506164965184775180738168837861091527357929701337
  72. 62177842752192623401942399639168044983993173312731
  73. 32924185707147349566916674687634660915035914677504
  74. 99518671430235219628894890102423325116913619626622
  75. 73267460800591547471830798392868535206946944540724
  76. 76841822524674417161514036427982273348055556214818
  77. 97142617910342598647204516893989422179826088076852
  78. 87783646182799346313767754307809363333018982642090
  79. 10848802521674670883215120185883543223812876952786
  80. 71329612474782464538636993009049310363619763878039
  81. 62184073572399794223406235393808339651327408011116
  82. 66627891981488087797941876876144230030984490851411
  83. 60661826293682836764744779239180335110989069790714
  84. 85786944089552990653640447425576083659976645795096
  85. 66024396409905389607120198219976047599490197230297
  86. 64913982680032973156037120041377903785566085089252
  87. 16730939319872750275468906903707539413042652315011
  88. 94809377245048795150954100921645863754710598436791
  89. 78639167021187492431995700641917969777599028300699
  90. 15368713711936614952811305876380278410754449733078
  91. 40789923115535562561142322423255033685442488917353
  92. 44889911501440648020369068063960672322193204149535
  93. 41503128880339536053299340368006977710650566631954
  94. 81234880673210146739058568557934581403627822703280
  95. 82616570773948327592232845941706525094512325230608
  96. 22918802058777319719839450180888072429661980811197
  97. 77158542502016545090413245809786882778948721859617
  98. 72107838435069186155435662884062257473692284509516
  99. 20849603980134001723930671666823555245252804609722
  100. 53503534226472524250874054075591789781264330331690'''

  101. str(sum([int (n) for n in num.split('\n')]))[:10]
复制代码
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-5-1 02:31:03 | 显示全部楼层
本帖最后由 天之南 于 2017-5-1 02:41 编辑
  1. #include<stdio.h>
  2. #include<string.h>

  3. int main()
  4. {
  5.         char num[] = "37107287533902102798797998220837590246510135740250463769376774900097126481248969700780504170182605387432498619952474105947423330951305812372661730962991942213363574161572522430563301811072406154908250230675882075393461711719803104210475137780632466768926167069662363382013637841838368417873436172675728112879812849979408065481931592621691275889832738442742289174325203219235894228767964876702721893184745144573600130643909116721685684458871160315327670386486105843025439939619828917593665686757934951621764571418565606295021572231965867550793241933316490635246274190492910143244581382266334794475817892575867718337217661963751590579239728245598838407582035653253593990084026335689488301894586282278288018119938482628201427819413994056758715117009439035398664372827112653829987240784473053190104293586865155060062958648615320752733719591914205172558297169388870771546649911559348760353292171497005693854370070576826684624621495650076471787294438377604532826541087568284431911906346940378552177792951453612327252500029607107508256381565671088525835072145876576172410976447339110607218265236877223636045174237069058518606604482076212098132878607339694128114266041808683061932846081119106155694051268969251934325451728388641918047049293215058642563049483624672216484350762017279180399446930047329563406911573244438690812579451408905770622942919710792820955037687525678773091862540744969844508330393682126183363848253301546861961243487676812975343759465158038628759287849020152168555482871720121925776695478182833757993103614740356856449095527097864797581167263201004368978425535399209318374414978068609844840309812907779179908821879532736447567559084803087086987551392711854517078544161852424320693150332599594068957565367821070749269665376763262354472106979395067965269474259770973916669376304263398708541052684708299085211399427365734116182760315001271653786073615010808570091499395125570281987460043753582903531743471732693212357815498262974255273730794953759765105305946966067683156574377167401875275889028025717332296191766687138199318110487701902712526768027607800301367868099252546340106163286652636270218540497705585629946580636237993140746255962240744869082311749777923654662572469233228109171419143028819710328859780666976089293863828502533340334413065578016127815921815005561868836468420090470230530811728164304876237919698424872550366387845831148769693215490281042402013833512446218144177347063783299490636259666498587618221225225512486764533677201869716985443124195724099139590089523100588229554825530026352078153229679624948164195386821877476085327132285723110424803456124867697064507995236377742425354112916842768655389262050249103265729672370191327572567528565324825826546309220705859652229798860272258331913126375147341994889534765745501184957014548792889848568277260777137214037988797153829820378303147352772158034814451349137322665138134829543829199918180278916522431027392251122869539409579530664052326325380441000596549391598795936352974615218550237130764225512118369380358038858490341698116222072977186158236678424689157993532961922624679571944012690438771072750481023908955235974572318970677254791506150550495392297953090112996751986188088225875314529584099251203829009407770775672113067397083047244838165338735023408456470580773088295917476714036319800818712901187549131054712658197623331044818386269515456334926366572897563400500428462801835170705278318394258821455212272512503275512160354698120058176216521282765275169129689778932238195734329339946437501907836945765883352399886755061649651847751807381688378610915273579297013376217784275219262340194239963916804498399317331273132924185707147349566916674687634660915035914677504995186714302352196288948901024233251169136196266227326746080059154747183079839286853520694694454072476841822524674417161514036427982273348055556214818971426179103425986472045168939894221798260880768528778364618279934631376775430780936333301898264209010848802521674670883215120185883543223812876952786713296124747824645386369930090493103636197638780396218407357239979422340623539380833965132740801111666627891981488087797941876876144230030984490851411606618262936828367647447792391803351109890697907148578694408955299065364044742557608365997664579509666024396409905389607120198219976047599490197230297649139826800329731560371200413779037855660850892521673093931987275027546890690370753941304265231501194809377245048795150954100921645863754710598436791786391670211874924319957006419179697775990283006991536871371193661495281130587638027841075444973307840789923115535562561142322423255033685442488917353448899115014406480203690680639606723221932041495354150312888033953605329934036800697771065056663195481234880673210146739058568557934581403627822703280826165707739483275922328459417065250945123252306082291880205877731971983945018088807242966198081119777158542502016545090413245809786882778948721859617721078384350691861554356628840622574736922845095162084960398013400172393067166682355524525280460972253503534226472524250874054075591789781264330331690";
  6.         int arr[50] = {0};
  7.         for (int i = 0;i < strlen(num);i += 1)
  8.         {
  9.                 arr[i % 50] += (num[i]-48);
  10.         }
  11.         double x = 10000000000.0;
  12.         double result = 0;
  13.         for (int i = 0;i < 50;i++)
  14.         {
  15.                 result += x*arr[i];
  16.                 x /= 10;
  17.         }
  18.         while (result / 10000000000 > 1)
  19.         {
  20.                 result /= 10;
  21.         }
  22.         printf("%lld", (long long)result);
  23.         return 0;
  24. }
复制代码

结果:5537376230
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-7-16 12:56:41 | 显示全部楼层
  1. '''Large sum
  2. Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.
  3. 计算出以下一百个50位数的和的前十位数字。'''
  4. str0 = '''37107287533902102798797998220837590246510135740250
  5. 46376937677490009712648124896970078050417018260538
  6. 74324986199524741059474233309513058123726617309629
  7. 91942213363574161572522430563301811072406154908250
  8. 23067588207539346171171980310421047513778063246676
  9. 89261670696623633820136378418383684178734361726757
  10. 28112879812849979408065481931592621691275889832738
  11. 44274228917432520321923589422876796487670272189318
  12. 47451445736001306439091167216856844588711603153276
  13. 70386486105843025439939619828917593665686757934951
  14. 62176457141856560629502157223196586755079324193331
  15. 64906352462741904929101432445813822663347944758178
  16. 92575867718337217661963751590579239728245598838407
  17. 58203565325359399008402633568948830189458628227828
  18. 80181199384826282014278194139940567587151170094390
  19. 35398664372827112653829987240784473053190104293586
  20. 86515506006295864861532075273371959191420517255829
  21. 71693888707715466499115593487603532921714970056938
  22. 54370070576826684624621495650076471787294438377604
  23. 53282654108756828443191190634694037855217779295145
  24. 36123272525000296071075082563815656710885258350721
  25. 45876576172410976447339110607218265236877223636045
  26. 17423706905851860660448207621209813287860733969412
  27. 81142660418086830619328460811191061556940512689692
  28. 51934325451728388641918047049293215058642563049483
  29. 62467221648435076201727918039944693004732956340691
  30. 15732444386908125794514089057706229429197107928209
  31. 55037687525678773091862540744969844508330393682126
  32. 18336384825330154686196124348767681297534375946515
  33. 80386287592878490201521685554828717201219257766954
  34. 78182833757993103614740356856449095527097864797581
  35. 16726320100436897842553539920931837441497806860984
  36. 48403098129077791799088218795327364475675590848030
  37. 87086987551392711854517078544161852424320693150332
  38. 59959406895756536782107074926966537676326235447210
  39. 69793950679652694742597709739166693763042633987085
  40. 41052684708299085211399427365734116182760315001271
  41. 65378607361501080857009149939512557028198746004375
  42. 35829035317434717326932123578154982629742552737307
  43. 94953759765105305946966067683156574377167401875275
  44. 88902802571733229619176668713819931811048770190271
  45. 25267680276078003013678680992525463401061632866526
  46. 36270218540497705585629946580636237993140746255962
  47. 24074486908231174977792365466257246923322810917141
  48. 91430288197103288597806669760892938638285025333403
  49. 34413065578016127815921815005561868836468420090470
  50. 23053081172816430487623791969842487255036638784583
  51. 11487696932154902810424020138335124462181441773470
  52. 63783299490636259666498587618221225225512486764533
  53. 67720186971698544312419572409913959008952310058822
  54. 95548255300263520781532296796249481641953868218774
  55. 76085327132285723110424803456124867697064507995236
  56. 37774242535411291684276865538926205024910326572967
  57. 23701913275725675285653248258265463092207058596522
  58. 29798860272258331913126375147341994889534765745501
  59. 18495701454879288984856827726077713721403798879715
  60. 38298203783031473527721580348144513491373226651381
  61. 34829543829199918180278916522431027392251122869539
  62. 40957953066405232632538044100059654939159879593635
  63. 29746152185502371307642255121183693803580388584903
  64. 41698116222072977186158236678424689157993532961922
  65. 62467957194401269043877107275048102390895523597457
  66. 23189706772547915061505504953922979530901129967519
  67. 86188088225875314529584099251203829009407770775672
  68. 11306739708304724483816533873502340845647058077308
  69. 82959174767140363198008187129011875491310547126581
  70. 97623331044818386269515456334926366572897563400500
  71. 42846280183517070527831839425882145521227251250327
  72. 55121603546981200581762165212827652751691296897789
  73. 32238195734329339946437501907836945765883352399886
  74. 75506164965184775180738168837861091527357929701337
  75. 62177842752192623401942399639168044983993173312731
  76. 32924185707147349566916674687634660915035914677504
  77. 99518671430235219628894890102423325116913619626622
  78. 73267460800591547471830798392868535206946944540724
  79. 76841822524674417161514036427982273348055556214818
  80. 97142617910342598647204516893989422179826088076852
  81. 87783646182799346313767754307809363333018982642090
  82. 10848802521674670883215120185883543223812876952786
  83. 71329612474782464538636993009049310363619763878039
  84. 62184073572399794223406235393808339651327408011116
  85. 66627891981488087797941876876144230030984490851411
  86. 60661826293682836764744779239180335110989069790714
  87. 85786944089552990653640447425576083659976645795096
  88. 66024396409905389607120198219976047599490197230297
  89. 64913982680032973156037120041377903785566085089252
  90. 16730939319872750275468906903707539413042652315011
  91. 94809377245048795150954100921645863754710598436791
  92. 78639167021187492431995700641917969777599028300699
  93. 15368713711936614952811305876380278410754449733078
  94. 40789923115535562561142322423255033685442488917353
  95. 44889911501440648020369068063960672322193204149535
  96. 41503128880339536053299340368006977710650566631954
  97. 81234880673210146739058568557934581403627822703280
  98. 82616570773948327592232845941706525094512325230608
  99. 22918802058777319719839450180888072429661980811197
  100. 77158542502016545090413245809786882778948721859617
  101. 72107838435069186155435662884062257473692284509516
  102. 20849603980134001723930671666823555245252804609722
  103. 53503534226472524250874054075591789781264330331690'''
  104. str1 = str0.split('\n')

  105. b = 0
  106. for i in range(100):
  107.     a = int(str1[i])
  108.     b += a

  109. print(str(b)[:10])
复制代码



answer: 5537376230
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-9-12 17:03:15 | 显示全部楼层
  1. arr='''37107287533902102798797998220837590246510135740250
  2. 46376937677490009712648124896970078050417018260538
  3. 74324986199524741059474233309513058123726617309629
  4. 91942213363574161572522430563301811072406154908250
  5. 23067588207539346171171980310421047513778063246676
  6. 89261670696623633820136378418383684178734361726757
  7. 28112879812849979408065481931592621691275889832738
  8. 44274228917432520321923589422876796487670272189318
  9. 47451445736001306439091167216856844588711603153276
  10. 70386486105843025439939619828917593665686757934951
  11. 62176457141856560629502157223196586755079324193331
  12. 64906352462741904929101432445813822663347944758178
  13. 92575867718337217661963751590579239728245598838407
  14. 58203565325359399008402633568948830189458628227828
  15. 80181199384826282014278194139940567587151170094390
  16. 35398664372827112653829987240784473053190104293586
  17. 86515506006295864861532075273371959191420517255829
  18. 71693888707715466499115593487603532921714970056938
  19. 54370070576826684624621495650076471787294438377604
  20. 53282654108756828443191190634694037855217779295145
  21. 36123272525000296071075082563815656710885258350721
  22. 45876576172410976447339110607218265236877223636045
  23. 17423706905851860660448207621209813287860733969412
  24. 81142660418086830619328460811191061556940512689692
  25. 51934325451728388641918047049293215058642563049483
  26. 62467221648435076201727918039944693004732956340691
  27. 15732444386908125794514089057706229429197107928209
  28. 55037687525678773091862540744969844508330393682126
  29. 18336384825330154686196124348767681297534375946515
  30. 80386287592878490201521685554828717201219257766954
  31. 78182833757993103614740356856449095527097864797581
  32. 16726320100436897842553539920931837441497806860984
  33. 48403098129077791799088218795327364475675590848030
  34. 87086987551392711854517078544161852424320693150332
  35. 59959406895756536782107074926966537676326235447210
  36. 69793950679652694742597709739166693763042633987085
  37. 41052684708299085211399427365734116182760315001271
  38. 65378607361501080857009149939512557028198746004375
  39. 35829035317434717326932123578154982629742552737307
  40. 94953759765105305946966067683156574377167401875275
  41. 88902802571733229619176668713819931811048770190271
  42. 25267680276078003013678680992525463401061632866526
  43. 36270218540497705585629946580636237993140746255962
  44. 24074486908231174977792365466257246923322810917141
  45. 91430288197103288597806669760892938638285025333403
  46. 34413065578016127815921815005561868836468420090470
  47. 23053081172816430487623791969842487255036638784583
  48. 11487696932154902810424020138335124462181441773470
  49. 63783299490636259666498587618221225225512486764533
  50. 67720186971698544312419572409913959008952310058822
  51. 95548255300263520781532296796249481641953868218774
  52. 76085327132285723110424803456124867697064507995236
  53. 37774242535411291684276865538926205024910326572967
  54. 23701913275725675285653248258265463092207058596522
  55. 29798860272258331913126375147341994889534765745501
  56. 18495701454879288984856827726077713721403798879715
  57. 38298203783031473527721580348144513491373226651381
  58. 34829543829199918180278916522431027392251122869539
  59. 40957953066405232632538044100059654939159879593635
  60. 29746152185502371307642255121183693803580388584903
  61. 41698116222072977186158236678424689157993532961922
  62. 62467957194401269043877107275048102390895523597457
  63. 23189706772547915061505504953922979530901129967519
  64. 86188088225875314529584099251203829009407770775672
  65. 11306739708304724483816533873502340845647058077308
  66. 82959174767140363198008187129011875491310547126581
  67. 97623331044818386269515456334926366572897563400500
  68. 42846280183517070527831839425882145521227251250327
  69. 55121603546981200581762165212827652751691296897789
  70. 32238195734329339946437501907836945765883352399886
  71. 75506164965184775180738168837861091527357929701337
  72. 62177842752192623401942399639168044983993173312731
  73. 32924185707147349566916674687634660915035914677504
  74. 99518671430235219628894890102423325116913619626622
  75. 73267460800591547471830798392868535206946944540724
  76. 76841822524674417161514036427982273348055556214818
  77. 97142617910342598647204516893989422179826088076852
  78. 87783646182799346313767754307809363333018982642090
  79. 10848802521674670883215120185883543223812876952786
  80. 71329612474782464538636993009049310363619763878039
  81. 62184073572399794223406235393808339651327408011116
  82. 66627891981488087797941876876144230030984490851411
  83. 60661826293682836764744779239180335110989069790714
  84. 85786944089552990653640447425576083659976645795096
  85. 66024396409905389607120198219976047599490197230297
  86. 64913982680032973156037120041377903785566085089252
  87. 16730939319872750275468906903707539413042652315011
  88. 94809377245048795150954100921645863754710598436791
  89. 78639167021187492431995700641917969777599028300699
  90. 15368713711936614952811305876380278410754449733078
  91. 40789923115535562561142322423255033685442488917353
  92. 44889911501440648020369068063960672322193204149535
  93. 41503128880339536053299340368006977710650566631954
  94. 81234880673210146739058568557934581403627822703280
  95. 82616570773948327592232845941706525094512325230608
  96. 22918802058777319719839450180888072429661980811197
  97. 77158542502016545090413245809786882778948721859617
  98. 72107838435069186155435662884062257473692284509516
  99. 20849603980134001723930671666823555245252804609722
  100. 53503534226472524250874054075591789781264330331690'''

  101. sp = arr.split('\n',100)
  102. for i in range(100):
  103.     sp[i] = int(sp[i])
  104. total = sum(sp)
  105. print(str(total)[0:10])
复制代码
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2018-4-4 09:41:55 | 显示全部楼层
  1. numlist = data.split('\n')
  2. print str(sum([int(i) for i in numlist]))[:10]
复制代码
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-4-16 20:23

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表