-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatom.xml
More file actions
1531 lines (1239 loc) · 43.1 KB
/
atom.xml
File metadata and controls
1531 lines (1239 loc) · 43.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[eBash]]></title>
<link href="http://kingfighter.github.io//atom.xml" rel="self"/>
<link href="http://kingfighter.github.io//"/>
<updated>2017-04-01T11:27:41+08:00</updated>
<id>http://kingfighter.github.io//</id>
<author>
<name><![CDATA[Lv Kaiyang(Kevin Lui)]]></name>
</author>
<generator uri="http://octopress.org/">Octopress</generator>
<entry>
<title type="html"><![CDATA[project euler without descriptions]]></title>
<link href="http://kingfighter.github.io//blog/2014/04/24/project-euler-simple/"/>
<updated>2014-04-24T15:22:00+08:00</updated>
<id>http://kingfighter.github.io//blog/2014/04/24/project-euler-simple</id>
<content type="html"><![CDATA[</p>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 Straight Forward</a></li>
<li><a href="#sec-2">2 Answer</a></li>
</ul>
</div>
</div>
<div id="outline-container-1" class="outline-2">
<h2 id="sec-1">Straight Forward</h2>
<div class="outline-text-2" id="text-1">
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup><col class="right" /></colgroup>
<colgroup><col class="right" /></colgroup><colgroup><col class="right" /></colgroup><colgroup><col class="right" /></colgroup><colgroup><col class="right" /></colgroup>
<thead>
</thead>
<tbody>
<tr><td class="right">32</td><td class="right">52</td><td class="right">41</td><td class="right">53</td><td class="right">38</td></tr>
</tbody>
<tbody>
<tr><td class="right">45228</td><td class="right">142857</td><td class="right">7652413</td><td class="right">4075</td><td class="right">932718654</td></tr>
</tbody>
<tbody>
<tr><td class="right">50</td><td class="right">56</td><td class="right">46</td><td class="right">43</td><td class="right">47</td></tr>
</tbody>
<tbody>
<tr><td class="right">997651</td><td class="right">972</td><td class="right">5777</td><td class="right">16695334890</td><td class="right">134043</td></tr>
</tbody>
<tbody>
<tr><td class="right">49</td><td class="right">55</td><td class="right">44</td><td class="right">97</td><td class="right"></td></tr>
</tbody>
<tbody>
<tr><td class="right">296962999629</td><td class="right">249</td><td class="right">5482660</td><td class="right">8739992577</td><td class="right"></td></tr>
</tbody>
</table>
</div>
</div>
<div id="outline-container-2" class="outline-2">
<h2 id="sec-2">Answer</h2>
<div class="outline-text-2" id="text-2">
<p>Source:<a href="https://github.com/kingFighter/project-euler">project-euler</a>
</p></div>
</div>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[project euler problem 33]]></title>
<link href="http://kingfighter.github.io//blog/2014/04/10/project-euler-33/"/>
<updated>2014-04-10T22:38:00+08:00</updated>
<id>http://kingfighter.github.io//blog/2014/04/10/project-euler-33</id>
<content type="html"><![CDATA[</p>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 Problem</a></li>
<li><a href="#sec-2">2 Solution</a></li>
<li><a href="#sec-3">3 Answer</a></li>
</ul>
</div>
</div>
<div id="outline-container-1" class="outline-2">
<h2 id="sec-1">Problem</h2>
<div class="outline-text-2" id="text-1">
<blockquote>
<p>The fraction 49/98 is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorrectly believe that 49/98 = 4/8, which is correct, is obtained by cancelling the 9s.
</p>
<p>
We shall consider fractions like, 30/50 = 3/5, to be trivial examples.
</p>
<p>
There are exactly four non-trivial examples of this type of fraction, less than one in value, and containing two digits in the numerator and denominator.
</p>
<p>
If the product of these four fractions is given in its lowest common terms, find the value of the denominator.
</p>
</blockquote>
</div>
</div>
<div id="outline-container-2" class="outline-2">
<h2 id="sec-2">Solution</h2>
<div class="outline-text-2" id="text-2">
<p>很简单,解空间很小,可直接Brute Force.
</p>
<p>
但我们可以进一步缩小解空间.其可能的四种形式:
</p><ol>
<li>\begin{eqnarray*}
\frac{10a+b}{10c+b} = \frac{a}{c}
\end{eqnarray*}
</li>
<li>\begin{eqnarray*}
\frac{10a+b}{10b+c} = \frac{a}{c}
\end{eqnarray*}
</li>
<li>\begin{eqnarray*}
\frac{10b+a}{10c+b} = \frac{a}{c}
\end{eqnarray*}
</li>
<li>\begin{eqnarray*}
\frac{10b+a}{10b+c} = \frac{a}{c}
\end{eqnarray*}
</li>
</ol>
<p>
对于1,4 化简得出a=c,与条件矛盾
</p>
<p>
对于3,可利用a,b,c <=9 及a<b可得到矛盾
</p>
<p>
对此只有2才是可能的形式
</p></div>
</div>
<div id="outline-container-3" class="outline-2">
<h2 id="sec-3">Answer</h2>
<div class="outline-text-2" id="text-3">
<p>100
</p>
<p>
Source:<a href="https://github.com/kingFighter/project-euler">project-euler</a>
</p></div>
</div>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[project euler problem 39]]></title>
<link href="http://kingfighter.github.io//blog/2014/04/05/project-euler-39/"/>
<updated>2014-04-05T00:09:00+08:00</updated>
<id>http://kingfighter.github.io//blog/2014/04/05/project-euler-39</id>
<content type="html"><![CDATA[</p>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 Problem</a></li>
<li><a href="#sec-2">2 Solution</a></li>
<li><a href="#sec-3">3 Answer</a></li>
</ul>
</div>
</div>
<div id="outline-container-1" class="outline-2">
<h2 id="sec-1">Problem</h2>
<div class="outline-text-2" id="text-1">
<blockquote>
<p>If p is the perimeter of a right angle triangle with integral length sides, {a,b,c}, there are exactly three solutions for p = 120.
</p>
<p>
{20,48,52}, {24,45,51}, {30,40,50}
</p>
<p>
For which value of p ≤ 1000, is the number of solutions maximised?
</p>
</blockquote>
</div>
</div>
<div id="outline-container-2" class="outline-2">
<h2 id="sec-2">Solution</h2>
<div class="outline-text-2" id="text-2">
<p>简单,Brute Force.
</p></div>
</div>
<div id="outline-container-3" class="outline-2">
<h2 id="sec-3">Answer</h2>
<div class="outline-text-2" id="text-3">
<p>840
</p>
<p>
Source:<a href="https://github.com/kingFighter/project-euler">project-euler</a>
</p></div>
</div>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[project euler problem 45]]></title>
<link href="http://kingfighter.github.io//blog/2014/04/04/project-euler-45/"/>
<updated>2014-04-04T23:28:00+08:00</updated>
<id>http://kingfighter.github.io//blog/2014/04/04/project-euler-45</id>
<content type="html"><![CDATA[</p>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 Problem</a></li>
<li><a href="#sec-2">2 Solution</a></li>
<li><a href="#sec-3">3 Answer</a></li>
</ul>
</div>
</div>
<div id="outline-container-1" class="outline-2">
<h2 id="sec-1">Problem</h2>
<div class="outline-text-2" id="text-1">
<blockquote>
<p>Triangle, pentagonal, and hexagonal numbers are generated by the following formulae:
</p>
<p>
Triangle Tn=n(n+1)/2 1, 3, 6, 10, 15, …
Pentagonal Pn=n(3n−1)/2 1, 5, 12, 22, 35, …
Hexagonal Hn=n(2n−1) 1, 6, 15, 28, 45, …
It can be verified that T285 = P165 = H143 = 40755.
</p>
<p>
Find the next triangle number that is also pentagonal and hexagonal.
</p>
</blockquote>
</div>
</div>
<div id="outline-container-2" class="outline-2">
<h2 id="sec-2">Solution</h2>
<div class="outline-text-2" id="text-2">
<p>简单,一元二次方程组.
</p></div>
</div>
<div id="outline-container-3" class="outline-2">
<h2 id="sec-3">Answer</h2>
<div class="outline-text-2" id="text-3">
<p>1533776805
</p>
<p>
Source:<a href="https://github.com/kingFighter/project-euler">project-euler</a>
</p></div>
</div>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[project euler problem 42]]></title>
<link href="http://kingfighter.github.io//blog/2014/03/14/project-euler-42/"/>
<updated>2014-03-14T21:11:00+08:00</updated>
<id>http://kingfighter.github.io//blog/2014/03/14/project-euler-42</id>
<content type="html"><![CDATA[</p>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 Problem</a></li>
<li><a href="#sec-2">2 Solution</a></li>
<li><a href="#sec-3">3 Answer</a></li>
</ul>
</div>
</div>
<div id="outline-container-1" class="outline-2">
<h2 id="sec-1">Problem</h2>
<div class="outline-text-2" id="text-1">
<blockquote>
<p>The nth term of the sequence of triangle numbers is given by, tn = ½n(n+1); so the first ten triangle numbers are:
</p>
<p>
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, …
</p>
<p>
By converting each letter in a word to a number corresponding to its alphabetical position and adding these values we form a word value. For example, the word value for SKY is 19 + 11 + 25 = 55 = t10. If the word value is a triangle number then we shall call the word a triangle word.
</p>
<p>
Using <a href="https://projecteuler.net/project/words.txt">words.txt</a> (right click and ‘Save Link/Target As…’), a 16K text file containing nearly two-thousand common English words, how many are triangle words?
</p>
</blockquote>
</div>
</div>
<div id="outline-container-2" class="outline-2">
<h2 id="sec-2">Solution</h2>
<div class="outline-text-2" id="text-2">
<p>太简单
</p></div>
</div>
<div id="outline-container-3" class="outline-2">
<h2 id="sec-3">Answer</h2>
<div class="outline-text-2" id="text-3">
<p>162
</p>
<p>
Source:<a href="https://github.com/kingFighter/project-euler">project-euler</a>
</p></div>
</div>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[project euler problem 31]]></title>
<link href="http://kingfighter.github.io//blog/2014/03/03/project-euler-31/"/>
<updated>2014-03-03T20:45:00+08:00</updated>
<id>http://kingfighter.github.io//blog/2014/03/03/project-euler-31</id>
<content type="html"><![CDATA[</p>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 Problem</a></li>
<li><a href="#sec-2">2 Solution</a>
<ul>
<li><a href="#sec-2-1">2.1 Brute Force</a></li>
<li><a href="#sec-2-2">2.2 Recursion</a></li>
<li><a href="#sec-2-3">2.3 DP</a></li>
</ul>
</li>
<li><a href="#sec-3">3 Answer</a></li>
</ul>
</div>
</div>
<div id="outline-container-1" class="outline-2">
<h2 id="sec-1">Problem</h2>
<div class="outline-text-2" id="text-1">
<blockquote>
<p>In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:
</p>
<p>
1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).
</p>
<p>
It is possible to make £2 in the following way:
</p>
<p>
1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p
</p>
<p>
How many different ways can £2 be made using any number of coins?
</p>
</blockquote>
</div>
</div>
<div id="outline-container-2" class="outline-2">
<h2 id="sec-2">Solution</h2>
<div class="outline-text-2" id="text-2">
</div>
<div id="outline-container-2-1" class="outline-3">
<h3 id="sec-2-1">Brute Force</h3>
<div class="outline-text-3" id="text-2-1">
<p>可以用穷举法:
</p>
<p>
200a+100b+50c+20d+10e+5f+2g+h = 200
</p>
<p>
穷尽a,b,c,d,e,f,g,h所有的可能.a:0~1, b:0~2…., 不过知道a = 1时, b:0,
可缩小a,b,c….大小范围, 见 C++Brute1, 类似的见C++Brute2
</p></div>
</div>
<div id="outline-container-2-2" class="outline-3">
<h3 id="sec-2-2">Recursion</h3>
<div class="outline-text-3" id="text-2-2">
<p>很直接的方法:
</p><ol>
<li>用一个200的coin, 没用其它的
</li>
<li>用零个200的coin, 由最大coin为100的来换零钱200
</li>
<li>用两个100的coin, 没用其它的
</li>
<li>用一个100的coin, 由最大coin为50的来换零钱100
</li>
<li>用零个100的coin, 由最大coin为50的来换零钱200
</li>
</ol>
<p> …..
</p>
<p>
这里大家应该能看出规律, 用公式表示:
</p>
<p>
\begin{eqnarray*}
f(t, c) = 1 & & if & c =1 &or& t=0 & \newline
f(t,c) = \sum_{i=0}^{\left \lfloor \frac{t}{c} \right \rfloor}f(t-ic, s(c)) & & if & c > 1 & and & t>0 &
\end{eqnarray*}
其中t是要换的钱, c是当前最大的coin,s(c)是下一个比c小的coin
</p>
<p>
见 C++Formula, 稍有不同的解法见 C++Formula1
</p>
</div>
</div>
<div id="outline-container-2-3" class="outline-3">
<h3 id="sec-2-3">DP</h3>
<div class="outline-text-3" id="text-2-3">
<p>见<a href="http://www.mathblog.dk/project-euler-31-combinations-english-currency-denominations/">分析</a>
</p></div>
</div>
</div>
<div id="outline-container-3" class="outline-2">
<h2 id="sec-3">Answer</h2>
<div class="outline-text-2" id="text-3">
<p>73682
</p>
<p>
Source:<a href="http://1drv.ms/Nn1zWO">C++Formula</a>, <a href="http://1drv.ms/1eVztrC">C++Formula1,</a> <a href="http://1drv.ms/1cnATAU">C++Brute1</a>, <a href="http://1drv.ms/1gMSteo">C++Brute2</a>, <a href="http://1drv.ms/1eVzMCU">dp</a>
</p></div>
</div>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[project euler problem 26]]></title>
<link href="http://kingfighter.github.io//blog/2014/03/02/project-euler-26/"/>
<updated>2014-03-02T14:13:00+08:00</updated>
<id>http://kingfighter.github.io//blog/2014/03/02/project-euler-26</id>
<content type="html"><![CDATA[</p>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 Problem</a></li>
<li><a href="#sec-2">2 Solution</a></li>
<li><a href="#sec-3">3 Answer</a></li>
</ul>
</div>
</div>
<div id="outline-container-1" class="outline-2">
<h2 id="sec-1">Problem</h2>
<div class="outline-text-2" id="text-1">
<blockquote>
<p>
A unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with denominators 2 to 10 are given:
</p>
<p>
1/2 = 0.5
</p>
<p>
1/3 = 0.(3)
</p>
<p>
1/4 = 0.25
</p>
<p>
1/5 = 0.2
</p>
<p>
1/6 = 0.1(6)
</p>
<p>
1/7 = 0.(142857)
</p>
<p>
1/8 = 0.125
</p>
<p>
1/9 = 0.(1)
</p>
<p>
1/10 = 0.1
</p>
<p>
Where 0.1(6) means 0.166666…, and has a 1-digit recurring cycle. It can be seen that 1/7 has a 6-digit recurring cycle.
</p>
<p>
Find the value of d < 1000 for which 1/d contains the longest recurring cycle in its decimal fraction part.
</p>
</blockquote>
</div>
</div>
<div id="outline-container-2" class="outline-2">
<h2 id="sec-2">Solution</h2>
<div class="outline-text-2" id="text-2">
<p> Brute Force,将小数部分保存vector中, 然后从头遍历寻找是否有相同的
pattern, 重复找到三次即认可.
</p>
<p>
更优的做法需要数学知识<sup><a class="footref" name="fnr-.1" href="#fn-.1">1</a></sup>
</p></div>
</div>
<div id="outline-container-3" class="outline-2">
<h2 id="sec-3">Answer</h2>
<div class="outline-text-2" id="text-3">
<p>983
</p>
<p>
Source:<a href="http://1drv.ms/1eOxC7U">C++</a>
</p>
<div id="footnotes">
<h2 class="footnotes">Footnotes: </h2>
<div id="text-footnotes">
<p class="footnote"><sup><a class="footnum" name="fn-.1" href="#fnr-.1">1</a></sup> <a href="http://mathworld.wolfram.com/DecimalExpansion.html">http://mathworld.wolfram.com/DecimalExpansion.html</a>
</p>
</div>
</div>
</div>
</div>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[project euler problem 40]]></title>
<link href="http://kingfighter.github.io//blog/2013/08/28/project-euler-40/"/>
<updated>2013-08-28T21:51:00+08:00</updated>
<id>http://kingfighter.github.io//blog/2013/08/28/project-euler-40</id>
<content type="html"><![CDATA[</p>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 Problem</a></li>
<li><a href="#sec-2">2 Solution</a></li>
<li><a href="#sec-3">3 Answer</a></li>
</ul>
</div>
</div>
<div id="outline-container-1" class="outline-2">
<h2 id="sec-1"><span class="section-number-2">1</span> Problem</h2>
<div class="outline-text-2" id="text-1">
<blockquote>
<p>An irrational decimal fraction is created by concatenating the positive integers:
</p>
<p>
0.123456789101112131415161718192021…
</p>
<p>
It can be seen that the \(12^{th}\) digit of the fractional part is 1.
</p>
<p>
If dn represents the nth digit of the fractional part, find the value of the following expression.
</p>
\begin{eqnarray*}
d_{1} × d_{10} × d_{100} × d_{1000} × d_{10000} × d_{100000} × d_{1000000}
\end{eqnarray*}
</blockquote>
</div>
</div>
<div id="outline-container-2" class="outline-2">
<h2 id="sec-2"><span class="section-number-2">2</span> Solution</h2>
<div class="outline-text-2" id="text-2">
<p>二分法,我们无法直接得知第ith的digit,但是容易知道number n所在的位置.要找ith的digit,其必夹在1~i number之间的某个位置.如:
</p>
<p>
找1000th的digit
</p><ol>
<li>其必夹在1~1000 number之间,易知 (1 + 1000) / 2 = 500 的最后一位0在序列中的位置为1392th(number 11的最后一位1的位置为13),比1000th大,则必在1~499间
</li>
<li>如此往复,我们可以找到最接近的number 370,其最后一位0为1002th,则1000th为digit 3
</li>
</ol>
<p>
依此法可以找到任意ith的digit
</p></div>
</div>
<div id="outline-container-3" class="outline-2">
<h2 id="sec-3"><span class="section-number-2">3</span> Answer</h2>
<div class="outline-text-2" id="text-3">
<p> 210
</p>
<p>
Source:<a href="http://sdrv.ms/1cjMvR3">C++</a>
</p>
</div>
</div>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[project euler problem 37]]></title>
<link href="http://kingfighter.github.io//blog/2013/08/26/project-euler-37/"/>
<updated>2013-08-26T23:38:00+08:00</updated>
<id>http://kingfighter.github.io//blog/2013/08/26/project-euler-37</id>
<content type="html"><![CDATA[</p>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 Problem</a></li>
<li><a href="#sec-2">2 Solution</a></li>
<li><a href="#sec-3">3 Answer</a></li>
</ul>
</div>
</div>
<div id="outline-container-1" class="outline-2">
<h2 id="sec-1"><span class="section-number-2">1</span> Problem</h2>
<div class="outline-text-2" id="text-1">
<blockquote>
<p>The number 3797 has an interesting property. Being prime itself, it is possible to continuously remove digits from left to right, and remain prime at each stage: 3797, 797, 97, and 7. Similarly we can work from right to left: 3797, 379, 37, and 3.
</p>
<p>
Find the sum of the only eleven primes that are both truncatable from left to right and right to left.
</p>
<p>
NOTE: 2, 3, 5, and 7 are not considered to be truncatable primes.
</p>
</blockquote>
</div>
</div>
<div id="outline-container-2" class="outline-2">
<h2 id="sec-2"><span class="section-number-2">2</span> Solution</h2>
<div class="outline-text-2" id="text-2">
<p>brute force
</p></div>
</div>
<div id="outline-container-3" class="outline-2">
<h2 id="sec-3"><span class="section-number-2">3</span> Answer</h2>
<div class="outline-text-2" id="text-3">
<p> 748317
</p>
<p>
Source:<a href="http://sdrv.ms/17eVSQE">C++</a>
</p>
</div>
</div>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[丰乳肥臀]]></title>
<link href="http://kingfighter.github.io//blog/2013/06/15/fengrufeitun/"/>
<updated>2013-06-15T16:35:00+08:00</updated>
<id>http://kingfighter.github.io//blog/2013/06/15/fengrufeitun</id>
<content type="html"><![CDATA[以前从来没有听说过莫言,直到他得奖了,然后我在图书馆找书时,就顺手借了本<a href="http://zh.wikipedia.org/wiki/丰乳肥臀">丰乳肥臀</a>。
</p>
<p>
我承认我很少看”正经”的小说,觉得无趣,抑或是因为无法沉下心来.
</p>
<p>
这本书讲述了从抗日到改革开放的上官家庭的命运。
</p>
<p>
上官鲁氏当真是十分的了不得,丈夫无能,饱受婆家欺凌,受人凌辱,她没有死去,她又十分的睿智,早已看出上官家女人的悲惨的命运.
</p>
<blockquote>
<p>我变了,也没变。这十几年里,上官家的人,像韭菜一样,一茬茬的死,一茬茬的发,有生就有死,死容易,活难,越难越要活。越不怕死越要挣扎着活。我要看到我的后代儿孙浮上水来那一天,你们都要给我争气!
</p>
</blockquote>
<p>
可惜,她的宝贝,混血儿上官金童却纯粹是个毫无出息的人,虽然一表人才,却是个一辈子吊在女人乳头上的窝囊废.窝囊归窝囊,却也是好人一个.
</p>
<p>
最讨厌的是六亲不认的上官盼弟与其女鲁胜利,都只为自己的前途,最终也没有个好下场.
</p>
<p>
八姐上官玉女最是让人怜惜
</p><blockquote>
<p>上官玉女二十多岁时,心理状态还像个小姑娘,胆怯的小姑娘,畏缩的小姑娘。她终生
都像蛹一样缩在茧里,生怕给家里人增添麻烦。
</p>
</blockquote>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[把妹达人]]></title>
<link href="http://kingfighter.github.io//blog/2013/06/15/The-Game/"/>
<updated>2013-06-15T14:09:00+08:00</updated>
<id>http://kingfighter.github.io//blog/2013/06/15/The-Game</id>
<content type="html"><![CDATA[<a href="http://book.douban.com/subject/3374558/">这本书</a> 看上去像是泡妞攻略手册,其实不如说是挫男的脱变史.
</p>
<p>
一群挫男用技巧在夜店把妹,自己变成了机器,最终逃离了这个圈子.
</p>
<p>
但其中的一些观点却也不是没有道理.
</p>
<blockquote>
<p>除了自信和微笑,我们学到,雄性领袖的其他特质是注重仪表、保持幽默感、与他人搏感
情、扮演一个空间里的社交中心
</p>
</blockquote>
<p>
自信和微笑,这两样总是富有感染力的
</p>
<blockquote>
<p>三秒法则.
</p>
</blockquote>
<p>
很多时候瞻前顾后与周密慎重只是一个度的问题.
</p>
<p>
方法是死的,用好用坏就是由人了.我们大可以用其中的技巧来与周围的人进行交际,来追求自己的另一半.但也切记不要忘记自己原来的初衷.
</p>]]></content>
</entry>
<entry>
<title type="html"><![CDATA[project euler problem 27]]></title>
<link href="http://kingfighter.github.io//blog/2013/06/14/project-euler-27/"/>
<updated>2013-06-14T23:31:00+08:00</updated>
<id>http://kingfighter.github.io//blog/2013/06/14/project-euler-27</id>
<content type="html"><![CDATA[</p>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 Problem</a></li>
<li><a href="#sec-2">2 Solution</a></li>
<li><a href="#sec-3">3 Answer</a></li>
</ul>
</div>
</div>
<div id="outline-container-1" class="outline-2">
<h2 id="sec-1"><span class="section-number-2">1</span> Problem</h2>
<div class="outline-text-2" id="text-1">
<blockquote>
<p>Euler discovered the remarkable quadratic formula:
</p>
<p>
n² + n + 41
</p>
<p>
It turns out that the formula will produce 40 primes for the consecutive values n = 0 to 39. However, when n = 40, 402 + 40 + 41 = 40(40 + 1) + 41 is divisible by 41, and certainly when n = 41, 41² + 41 + 41 is clearly divisible by 41.
</p>
<p>
The incredible formula n² - 79n + 1601 was discovered, which produces 80 primes for the consecutive values n = 0 to 79. The product of the coefficients, -79 and 1601, is -126479.
</p>
<p>
Considering quadratics of the form:
</p>
<p>
n² + an + b, where |a| < 1000 and |b| < 1000
</p>
<p>
where |n| is the modulus/absolute value of n <br/>
e.g. |11| = 11 and |-4| = 4
</p>
<p>
Find the product of the coefficients, a and b, for the quadratic expression that produces the maximum number of primes for consecutive values of n, starting with n = 0.
</p>
</blockquote>
</div>
</div>
<div id="outline-container-2" class="outline-2">
<h2 id="sec-2"><span class="section-number-2">2</span> Solution</h2>
<div class="outline-text-2" id="text-2">
<p> Brute Force,当然如果n为0时,可知b必为素数.还可以试图代入n = 1等,得出a,b相应性质,减小复杂度
</p></div>
</div>
<div id="outline-container-3" class="outline-2">
<h2 id="sec-3"><span class="section-number-2">3</span> Answer</h2>
<div class="outline-text-2" id="text-3">
<p> -59231
</p>
<p>
Source:<a href="http://sdrv.ms/12MpHJ9">C++</a>
</p></div>
</div>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[project euler problem 35]]></title>
<link href="http://kingfighter.github.io//blog/2013/06/14/project-euler-35/"/>
<updated>2013-06-14T22:44:00+08:00</updated>
<id>http://kingfighter.github.io//blog/2013/06/14/project-euler-35</id>
<content type="html"><![CDATA[</p>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 Problem</a></li>
<li><a href="#sec-2">2 Solution</a></li>
<li><a href="#sec-3">3 Answer</a></li>
</ul>
</div>
</div>
<div id="outline-container-1" class="outline-2">
<h2 id="sec-1"><span class="section-number-2">1</span> Problem</h2>
<div class="outline-text-2" id="text-1">
<blockquote>
<p> The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime.
</p>
<p>
There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97.
</p>
<p>
How many circular primes are there below one million?
</p>
</blockquote>
</div>
</div>
<div id="outline-container-2" class="outline-2">
<h2 id="sec-2"><span class="section-number-2">2</span> Solution</h2>
<div class="outline-text-2" id="text-2">
<p> brute force,没什么好说的
</p></div>
</div>
<div id="outline-container-3" class="outline-2">
<h2 id="sec-3"><span class="section-number-2">3</span> Answer</h2>
<div class="outline-text-2" id="text-3">
<p> 55
</p>
<p>
Source:<a href="http://sdrv.ms/12MpN3F">C++</a>
</p></div>
</div>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[project euler problem 36]]></title>
<link href="http://kingfighter.github.io//blog/2013/06/10/project-euler-36/"/>
<updated>2013-06-10T20:24:00+08:00</updated>
<id>http://kingfighter.github.io//blog/2013/06/10/project-euler-36</id>
<content type="html"><![CDATA[</p>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 Problem</a></li>
<li><a href="#sec-2">2 Solution</a>
<ul>
<li><a href="#sec-2-1">2.1 Brute Force</a></li>
<li><a href="#sec-2-2">2.2 Generate</a></li>
</ul>
</li>
<li><a href="#sec-3">3 Answer</a></li>
</ul>
</div>
</div>
<div id="outline-container-1" class="outline-2">
<h2 id="sec-1"><span class="section-number-2">1</span> Problem</h2>
<div class="outline-text-2" id="text-1">
<blockquote>
<p> The decimal number, 585 = \(1001001001_2\) (binary), is palindromic in both bases.
</p>
<p>
Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2.
</p>
<p>
(Please note that the palindromic number, in either base, may not include leading zeros.)
</p>