Added a few generic problems\nSolved Euler027
This commit is contained in:
53
CodeGolf/guns-and-zips/input.1
Normal file
53
CodeGolf/guns-and-zips/input.1
Normal file
@ -0,0 +1,53 @@
|
||||
??r?Jlogo.png?)??PNG
|
||||
|
||||
|
||||
IHDRLK?~)sBIT??O? pHYs??~?tEXtSoftwareMacromedia Fireworks 8?h?xtEXtCreation Time20/7/06?t?-IDATx???{ts??{???=?F??Foi???lK????Bx8??/???k?5??d7??
|
||||
96K?n8,7a??@K??!k`?!61Y$|?d
|
||||
?,y?????Hc?C???????????3?IT???[??j???W??FX?[??f?H$E?B!A??h4"?h?2?lC?-???l>w????po?e ????+--?l@ ?
|
||||
dkZ???? ?D?~W?~PE?dOOOSS?d?l??-?g?}&?H???òl(jmm?cG?s?lC
|
||||
?]?(j||<???H?R???J?4M?,+????S]?@?Sp????H$BD?d8??L&?e?;M????'?l??7??|d?X?a? P?H)xK?r???a???R?KKKkkk?1d?PX?G"?la???D????ryA??l7
|
||||
?]??e??eE???
|
||||
?dR?1?N?cF`?`0X??@ ????a?cr?l6???Z???l+
|
||||
+r??g0?b????H$-?{?VVQ?P?eY?Au,?)??f ?n?N??j?????'2s$?D???}?????????R??
|
||||
?@?K?Eß??h?x?"A?5g?iZ???'?"gYvlllaa!?r?T?4??(EQy????????T*?j?*EQUUU???(?¾:?w?&*??433#?H?]?.??nw0?Dpm)?w?#???Y????#=
|
||||
? ?`pttTx`NDn4sV8?a????????c?"?X,R?t?=m?Xl4???&??@????~???T*?|>?
|
||||
a?w?;???e?g??k???5?L&`5%w??F??#pC!?f)9?<\?t)?j?????|?@ ???e????<Nk?4???S^^>>>'? ?????V???J~;?j?z??kkk6?-_f!?A??Hdlll3??q?,???H$R(:?nll6?H?Z?F?????OF???;???#??a??azN?r???????1?@?Ev"?x<?J??f?[j??????V?5???@?-?|yy9?
|
||||
G?a?h@+??===###[?Me?O?,Dß??j-?'?!I2z???_???b?o?lC?y0?z????A?ñ?'?w/\|
|
||||
???,k?X
|
||||
????V?N????l.?!?m?P?33;;[?:?B??"???w??y?C ?D???v{8.?l?$~S???? ????B??>-?SSS8?*(?(rA???3::*???$)???~????hSt???ry?8???r?Zm4???q??!???l?81y?/o?)????rya??e?8?KS=?e?q??;?jEUuUs?????4
|
||||
$)?*???,\(????N'? ??{????^_8w@??9?c#???p???[???"???85=???{?f???J??}??g_??P???]????u??wGP???|?,?[????*?J?*))?|?rggg!2PB??|??!wZ\???VB???/_7y??w^x??F/?LN??a??#?}???<B?\4?????z{{O?:??????g7??G????????b??hh(o???w??5U(???Rn[?·j?:????.??T2???D?T?????I??I+??H????1
|
||||
????6?B{?[A?z????/PK??8I??P? ?T?P??%%%F????#?;??????Kg??F?
|
||||
?^ä?(8???????n?V\{?.P?k??C&2?y?Z=????w"&?? =?e?eyh??y??ny??????mV'@???)????????_O?+???~z6??Cr@P?U?PVpm??s?????+**????Je?????Í?s???L?>?????i??D???'w(?????g8!???<????*????7M?J??(??????????l?? ?d9? ???rH?b??eY???v????e2?^???t?>?R??j????]]]???]>u?3?J?i???]Zle???G'
|
||||
??-??[S?N?????s?????(?\?????,??B?C~??????G?U??e??[Hnd9?06????"DD$q/?$
|
||||
??????????Z?k?????????<l~6V???=?????og?}??????_???X??o>??#}E?G]zpr?????????3???,]???@???DP???]?r??mt??L??????f?o???=?lT??['??;??K????????W7??F????l]?b?????*?$??????b?a>???o???????s?c??6?#???=????v}?`m\??}?bJ?V?h??t??"?Q?-?A??W}aD?b<?O????%?*?k*??:?ut?w???W<???o?g?^^?z{???IL???m[@Hv?Ag?(J????o??fA?RiUU?K?????\?:5??B
|
||||
?CiB????#I???#???
|
||||
?!??????NZ??K????o???j??r???;??]?b;M??|??;w$f69?3b{+??$I?<p?]R???X?????`??#?????t????o??????Lf?AM???B$??P(?}qm?]I???22?M?&p??+?+??;/??$u?????????k*l??O?|4K?1??x?[?N2??4????w???O???]??#?7?e???? ??0??1??,.?=?????Z?$I~!
|
||||
?`Y6?o?D"iii???p]?0??gb??^????7?t?k?b????????qLY?;?pUu?]m?M?t? _?U?xp?M????????^???`???????<??W?<^?8?R2W|??^?H? "?l??????Iwttd??1?<???????z??????;???s?Kc??????@???j0???'y>??S?F??????g???p?O??????ub???;U???m???bfC?B???>V??Y?_?x
|
||||
???D"???2?LB6I??OQ?(r?$?Z-????B???????9??w??;??k????%?7?F;????????? ?S?????????Jq~?????:XE?????A??8?:?ap???s#??.Rqq?dt?V/g]^a5??? P? O??????. ?$m6?R??h?v? x?????????????J????)?(???a?L????????w?}7??=????c??g2????t:????QO????E???2???[P??on??l????+g?O??eO?7???(@:??s???+'_O??????uy???R??????L&?B????????Z?H??2<??u???d*[õ?*B?d?U*????.]R*?\DY??.??Y?eEQnII?u??P(TVV?w??D???.\?gOjXE?X6$??#r??xU*c_ X?~??l????????F??Wa(vj????z?????LCl??:M1 m??%!W*E??Y??&???, ???+???knn9,?0@S4??n?Ve7CpX?????????R4???W??U?D?0??i? ?e????$Yd???u-?Yf??{????$PT?k5q3??Ew[??N+))a???AE+++Q
|
||||
??4Mbkt?e#?H8??????????b??MD?kk?S????2D?Yg?[M)´?j??T×?\??me??F[.?f???H?J?L?p??G?2?U??????;?|??????(K??????{?d9?w??dI??????2(??hmiim?h?W??`??8?cl?v??+?3??d?@??w?u?oe?,?U????Tx??????????6???M0????j?????n?V????E-..???5.N&??8y?,??F???Ht?u?????Ti?v?c???>?~dG_?%UeD[f???????b???q????]????+?????o.?????+4???r????DUR?R(d
|
||||
a?(?-Ml????????**?u??:?????n-?cy?w??H$J?????H?h.???QG ?\??{D???J?$=?2??"B???2'? +???F?4^?
|
||||
*????????}?DW4U?s3?r}?x?f?J??j`?}?Ib9i??1????;A?E??????L&??[W?a
|
||||
|
||||
|
||||
???$I?|?P(???b?Z???s??aX?eYV"?????????[S???`0??L?| YQC{78?U?>??K#?????O??????a?7.????
|
||||
?%?S???L~2@Ug?,????_NvU?
|
||||
?E?t??u?3????O??l?(^?= s??e?4?X
|
||||
???????C+???N????s?Ri?t-???;?B??j??o\`??m&Z??0???h^)n??U9?h??d
|
||||
*Pl???~o$?u?Y?1(???p???biz????W?-??$??<WW5u-??q?????4??R?P?H$??,A??h4:?N*?R?W\1?u?)?R(???;v????[;;;* ????.\??2??????>??/~??"??e???V?;?>?1?6?u?7???V ?B[ÿ?????{?R?A%??s?????4???#??}J????k7?
|
||||
z????S????!??n
|
||||
???"?(?????uB?'?? +U? ?"%???D?~DZ????3???!??vX,Kk$?????:mK?`Es?4z.?u??@T]W??R?B??r??{????
|
||||
y?ZVZZj4?^/????LNNNNN?wt?,KQI?$I?????????<xpppp??????%%%9??455??vn??w?3???????o???^????=????y?][?o?7n??????????o?\??'????u???'~???=?>??????$???1???of{??O-?w??U??7_???{l??1?{o????b&G?uy7???<2?>??/|?JGGG8?9?C???^O?Nx??
|
||||
?E#??,?!???(e?w-.oB,D"$??J?J?.??)???Qmk?N??+???Sy?Z?2 B????????hB?\t4M;????E?)_
|
||||
?0???????>n???h*++?Z?L&?W??H$?????????{??????~??>r?{W[?8?d?j?l4Vbt???v????-??o??`???i??N?}-???w??_??Hq??q~x?5????????[?vW??|???;]???????Zc?8c????^???????-?H???f?L/??orCy????oN?{j??????45?q?]_n/`n???y7&?????????o??"}??J?A8??????,?????\@??Z??B@-l?d?J\???CH%??+T???"T|?EX4?MJK?B?8?f??J ?>\Y%K1H?(???[?ZXt?k???????T?V?D^"1?Xy?œ??@ ??q?????i?@ 044t????)sp?nmm?{wcc?F?????~S?T?!n? >??????c#K???%O?m?Jmn?-?/_??^????????????G??G??5??+???%W?F??3W??u_?U?;w?????<???????u
|
||||
A/Duc?W??o}?_B[?>?Y?w????a???Ue[^???o???+?]???????rC?????~??-q?X????{?j?z?t: ????#?Z??m?e???^Y
|
||||
1??R?B????????_?i?)?3?X?\]Z^YY?????$?
|
||||
?2?ZZ??????7?,Q??m&ZP+T?f6/???n??D??b?N?O?)%DbZ^rI4???????Bp??T?*q???+5 ??@A??I,cI???.?x?b5??z?$?p8??????4X8???i?D"?????.};?y?f??l??????W~????'S
|
||||
q???????[?}K???o?????q]??'???I????u
|
||||
??h???t??x#?C?_?.
|
||||
???u?b?Uu?????Q?"???_??????6?i???/?{?Nm?k9???.????T?O????G;???O??-C??????miiI?FH.pG??,C??a<?%?a(
|
||||
???????A??M??????$?r?????9?|zzzjjJ"???????????g????on???Tn?(!??????+?Kre?VSS[^SQ?????Uw(?KJ?????????
|
||||
???????9´'H?8?I??E?M?G???
|
||||
?I~1k*j?5???'????? ~`&D84M;?N????????s?????Vkg[$immmkk?=??`??\???1??????????A??VUU?4???q\?????????~?TVVR%|??T*moo?
|
||||
??T???d%?E?E Y?"??????? eeei?? ?mK."_XX??|E?a???????d???(???!?xr?F?!?[???????>?o||??Io?#???:???'!??L2;? ?0?????x<??ES?? BQ?F???????25/8??????*??
|
||||
?\.Wuu???q/???D?}9?4MQ????w
|
||||
?????uuu?`?eY?????QE$?-??H$BQ?a???Q?V??O??$944? ???FQT$I?R8??aB??????||?4??2??m?9?P%I??t???T}rN?E?????f~w?qn?????????]??{??Enh???????C.???G??7??M??$???????RIEND?B`??*??
|
53
CodeGolf/guns-and-zips/output.1
Normal file
53
CodeGolf/guns-and-zips/output.1
Normal file
@ -0,0 +1,53 @@
|
||||
?PNG
|
||||
|
||||
|
||||
IHDRLK?~)sBIT??O? pHYs??~?tEXtSoftwareMacromedia Fireworks 8?h?xtEXtCreation Time20/7/06?t?-IDATx???{ts??{???=?F??Foi???lK????Bx8??/???k?5??d7??
|
||||
96K?n8,7a??@K??!k`?!61Y$|?d
|
||||
?,y?????Hc?C???????????3?IT???[??j???W??FX?[??f?H$E?B!A??h4"?h?2?lC?-???l>w????po?e ????+--?l@ ?
|
||||
dkZ???? ?D?~W?~PE?dOOOSS?d?l??-?g?}&?H???òl(jmm?cG?s?lC
|
||||
?]?(j||<???H?R???J?4M?,+????S]?@?Sp????H$BD?d8??L&?e?;M????'?l??7??|d?X?a? P?H)xK?r???a???R?KKKkkk?1d?PX?G"?la???D????ryA??l7
|
||||
?]??e??eE???
|
||||
?dR?1?N?cF`?`0X??@ ????a?cr?l6???Z???l+
|
||||
+r??g0?b????H$-?{?VVQ?P?eY?Au,?)??f ?n?N??j?????'2s$?D???}?????????R??
|
||||
?@?K?Eß??h?x?"A?5g?iZ???'?"gYvlllaa!?r?T?4??(EQy????????T*?j?*EQUUU???(?¾:?w?&*??433#?H?]?.??nw0?Dpm)?w?#???Y????#=
|
||||
? ?`pttTx`NDn4sV8?a????????c?"?X,R?t?=m?Xl4???&??@????~???T*?|>?
|
||||
a?w?;???e?g??k???5?L&`5%w??F??#pC!?f)9?<\?t)?j?????|?@ ???e????<Nk?4???S^^>>>'? ?????V???J~;?j?z??kkk6?-_f!?A??Hdlll3??q?,???H$R(:?nll6?H?Z?F?????OF???;???#??a??azN?r???????1?@?Ev"?x<?J??f?[j??????V?5???@?-?|yy9?
|
||||
G?a?h@+??===###[?Me?O?,Dß??j-?'?!I2z???_???b?o?lC?y0?z????A?ñ?'?w/\|
|
||||
???,k?X
|
||||
????V?N????l.?!?m?P?33;;[?:?B??"???w??y?C ?D???v{8.?l?$~S???? ????B??>-?SSS8?*(?(rA???3::*???$)???~????hSt???ry?8???r?Zm4???q??!???l?81y?/o?)????rya??e?8?KS=?e?q??;?jEUuUs?????4
|
||||
$)?*???,\(????N'? ??{????^_8w@??9?c#???p???[???"???85=???{?f???J??}??g_??P???]????u??wGP???|?,?[????*?J?*))?|?rggg!2PB??|??!wZ\???VB???/_7y??w^x??F/?LN??a??#?}???<B?\4?????z{{O?:??????g7??G????????b??hh(o???w??5U(???Rn[?·j?:????.??T2???D?T?????I??I+??H????1
|
||||
????6?B{?[A?z????/PK??8I??P? ?T?P??%%%F????#?;??????Kg??F?
|
||||
?^ä?(8???????n?V\{?.P?k??C&2?y?Z=????w"&?? =?e?eyh??y??ny??????mV'@???)????????_O?+???~z6??Cr@P?U?PVpm??s?????+**????Je?????Í?s???L?>?????i??D???'w(?????g8!???<????*????7M?J??(??????????l?? ?d9? ???rH?b??eY???v????e2?^???t?>?R??j????]]]???]>u?3?J?i???]Zle???G'
|
||||
??-??[S?N?????s?????(?\?????,??B?C~??????G?U??e??[Hnd9?06????"DD$q/?$
|
||||
??????????Z?k?????????<l~6V???=?????og?}??????_???X??o>??#}E?G]zpr?????????3???,]???@???DP???]?r??mt??L??????f?o???=?lT??['??;??K????????W7??F????l]?b?????*?$??????b?a>???o???????s?c??6?#???=????v}?`m\??}?bJ?V?h??t??"?Q?-?A??W}aD?b<?O????%?*?k*??:?ut?w???W<???o?g?^^?z{???IL???m[@Hv?Ag?(J????o??fA?RiUU?K?????\?:5??B
|
||||
?CiB????#I???#???
|
||||
?!??????NZ??K????o???j??r???;??]?b;M??|??;w$f69?3b{+??$I?<p?]R???X?????`??#?????t????o??????Lf?AM???B$??P(?}qm?]I???22?M?&p??+?+??;/??$u?????????k*l??O?|4K?1??x?[?N2??4????w???O???]??#?7?e???? ??0??1??,.?=?????Z?$I~!
|
||||
?`Y6?o?D"iii???p]?0??gb??^????7?t?k?b????????qLY?;?pUu?]m?M?t? _?U?xp?M????????^???`???????<??W?<^?8?R2W|??^?H? "?l??????Iwttd??1?<???????z??????;???s?Kc??????@???j0???'y>??S?F??????g???p?O??????ub???;U???m???bfC?B???>V??Y?_?x
|
||||
???D"???2?LB6I??OQ?(r?$?Z-????B???????9??w??;??k????%?7?F;????????? ?S?????????Jq~?????:XE?????A??8?:?ap???s#??.Rqq?dt?V/g]^a5??? P? O??????. ?$m6?R??h?v? x?????????????J????)?(???a?L????????w?}7??=????c??g2????t:????QO????E???2???[P??on??l????+g?O??eO?7???(@:??s???+'_O??????uy???R??????L&?B????????Z?H??2<??u???d*[õ?*B?d?U*????.]R*?\DY??.??Y?eEQnII?u??P(TVV?w??D???.\?gOjXE?X6$??#r??xU*c_ X?~??l????????F??Wa(vj????z?????LCl??:M1 m??%!W*E??Y??&???, ???+???knn9,?0@S4??n?Ve7CpX?????????R4???W??U?D?0??i? ?e????$Yd???u-?Yf??{????$PT?k5q3??Ew[??N+))a???AE+++Q
|
||||
??4Mbkt?e#?H8??????????b??MD?kk?S????2D?Yg?[M)´?j??T×?\??me??F[.?f???H?J?L?p??G?2?U??????;?|??????(K??????{?d9?w??dI??????2(??hmiim?h?W??`??8?cl?v??+?3??d?@??w?u?oe?,?U????Tx??????????6???M0????j?????n?V????E-..???5.N&??8y?,??F???Ht?u?????Ti?v?c???>?~dG_?%UeD[f???????b???q????]????+?????o.?????+4???r????DUR?R(d
|
||||
a?(?-Ml????????**?u??:?????n-?cy?w??H$J?????H?h.???QG ?\??{D???J?$=?2??"B???2'? +???F?4^?
|
||||
*????????}?DW4U?s3?r}?x?f?J??j`?}?Ib9i??1????;A?E??????L&??[W?a
|
||||
|
||||
|
||||
???$I?|?P(???b?Z???s??aX?eYV"?????????[S???`0??L?| YQC{78?U?>??K#?????O??????a?7.????
|
||||
?%?S???L~2@Ug?,????_NvU?
|
||||
?E?t??u?3????O??l?(^?= s??e?4?X
|
||||
???????C+???N????s?Ri?t-???;?B??j??o\`??m&Z??0???h^)n??U9?h??d
|
||||
*Pl???~o$?u?Y?1(???p???biz????W?-??$??<WW5u-??q?????4??R?P?H$??,A??h4:?N*?R?W\1?u?)?R(???;v????[;;;* ????.\??2??????>??/~??"??e???V?;?>?1?6?u?7???V ?B[ÿ?????{?R?A%??s?????4???#??}J????k7?
|
||||
z????S????!??n
|
||||
???"?(?????uB?'?? +U? ?"%???D?~DZ????3???!??vX,Kk$?????:mK?`Es?4z.?u??@T]W??R?B??r??{????
|
||||
y?ZVZZj4?^/????LNNNNN?wt?,KQI?$I?????????<xpppp??????%%%9??455??vn??w?3???????o???^????=????y?][?o?7n??????????o?\??'????u???'~???=?>??????$???1???of{??O-?w??U??7_???{l??1?{o????b&G?uy7???<2?>??/|?JGGG8?9?C???^O?Nx??
|
||||
?E#??,?!???(e?w-.oB,D"$??J?J?.??)???Qmk?N??+???Sy?Z?2 B????????hB?\t4M;????E?)_
|
||||
?0???????>n???h*++?Z?L&?W??H$?????????{??????~??>r?{W[?8?d?j?l4Vbt???v????-??o??`???i??N?}-???w??_??Hq??q~x?5????????[?vW??|???;]???????Zc?8c????^???????-?H???f?L/??orCy????oN?{j??????45?q?]_n/`n???y7&?????????o??"}??J?A8??????,?????\@??Z??B@-l?d?J\???CH%??+T???"T|?EX4?MJK?B?8?f??J ?>\Y%K1H?(???[?ZXt?k???????T?V?D^"1?Xy?œ??@ ??q?????i?@ 044t????)sp?nmm?{wcc?F?????~S?T?!n? >??????c#K???%O?m?Jmn?-?/_??^????????????G??G??5??+???%W?F??3W??u_?U?;w?????<???????u
|
||||
A/Duc?W??o}?_B[?>?Y?w????a???Ue[^???o???+?]???????rC?????~??-q?X????{?j?z?t: ????#?Z??m?e???^Y
|
||||
1??R?B????????_?i?)?3?X?\]Z^YY?????$?
|
||||
?2?ZZ??????7?,Q??m&ZP+T?f6/???n??D??b?N?O?)%DbZ^rI4???????Bp??T?*q???+5 ??@A??I,cI???.?x?b5??z?$?p8??????4X8???i?D"?????.};?y?f??l??????W~????'S
|
||||
q???????[?}K???o?????q]??'???I????u
|
||||
??h???t??x#?C?_?.
|
||||
???u?b?Uu?????Q?"???_??????6?i???/?{?Nm?k9???.????T?O????G;???O??-C??????miiI?FH.pG??,C??a<?%?a(
|
||||
???????A??M??????$?r?????9?|zzzjjJ"???????????g????on???Tn?(!??????+?Kre?VSS[^SQ?????Uw(?KJ?????????
|
||||
???????9´'H?8?I??E?M?G???
|
||||
?I~1k*j?5???'????? ~`&D84M;?N????????s?????Vkg[$immmkk?=??`??\???1??????????A??VUU?4???q\?????????~?TVVR%|??T*moo?
|
||||
??T???d%?E?E Y?"??????? eeei?? ?mK."_XX??|E?a???????d???(???!?xr?F?!?[???????>?o||??Io?#???:???'!??L2;? ?0?????x<??ES?? BQ?F???????25/8??????*??
|
||||
?\.Wuu???q/???D?}9?4MQ????w
|
||||
?????uuu?`?eY?????QE$?-??H$BQ?a???Q?V??O??$944? ???FQT$I?R8??aB??????||?4??2??m?9?P%I??t???T}rN?E?????f~w?qn?????????]??{??Enh???????C.???G??7??M??$???????RIEND?B`?
|
0
CodeGolf/guns-and-zips/solve.php
Normal file
0
CodeGolf/guns-and-zips/solve.php
Normal file
BIN
Generic/Fibonacci/a.exe
Normal file
BIN
Generic/Fibonacci/a.exe
Normal file
Binary file not shown.
51
Generic/Fibonacci/solve.c
Normal file
51
Generic/Fibonacci/solve.c
Normal file
@ -0,0 +1,51 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#define SIZE 20
|
||||
|
||||
|
||||
|
||||
void add(char *a, char *b, char *result, int size) {
|
||||
int i = 0;
|
||||
for(i=0;i<size;i++) {
|
||||
//We have overflow!
|
||||
if((a[i] + b[i] + result[i] < a[i]) || (a[i] + b[i] + result[i] < b[i])) {
|
||||
result[i+1]++;
|
||||
}
|
||||
result[i]+= a[i] + b[i];
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
int main( )
|
||||
{
|
||||
unsigned char prev[SIZE];
|
||||
unsigned char current[SIZE];
|
||||
unsigned char next[SIZE];
|
||||
unsigned int i=0;
|
||||
memset(prev,0x00,SIZE);
|
||||
memset(current,0x00,SIZE);
|
||||
memset(next,0x00,SIZE);
|
||||
prev[0]=1;
|
||||
current[0]=1;
|
||||
next[0]=1;
|
||||
|
||||
for(i=2;i<100;i++) {
|
||||
|
||||
add(current,prev,next,SIZE);
|
||||
memcpy(prev,current,SIZE);
|
||||
memcpy(current,next,SIZE);
|
||||
//prev = current;
|
||||
//current = next;
|
||||
int j;
|
||||
for(j=0;j<SIZE;j++) {
|
||||
printf("%d: %i\n",j,current[j]);
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0;i<SIZE;i++) {
|
||||
printf("%d: %i\n",i,current[i]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
BIN
Generic/Fibonacci/solve.exe
Normal file
BIN
Generic/Fibonacci/solve.exe
Normal file
Binary file not shown.
1
Generic/HelloWorld/solve.js
Normal file
1
Generic/HelloWorld/solve.js
Normal file
@ -0,0 +1 @@
|
||||
console.log("Hello World");
|
20
Generic/MultiTable/solve.c
Normal file
20
Generic/MultiTable/solve.c
Normal file
@ -0,0 +1,20 @@
|
||||
#include <stdio.h>
|
||||
#define SIZE_X 12
|
||||
#define SIZE_Y 12
|
||||
void main()
|
||||
{
|
||||
int x,y;
|
||||
int MemorizeThis[SIZE_X][SIZE_Y];
|
||||
for (x =1; x <= SIZE_X; x++)
|
||||
{
|
||||
for (y = 1; y <= SIZE_Y; y++)
|
||||
{
|
||||
MemorizeThis[x-1][y-1] = x * y;
|
||||
printf("[%03d]", MemorizeThis[x-1][y-1]);
|
||||
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
return;
|
||||
}
|
10
Generic/Seive/desc.yml
Normal file
10
Generic/Seive/desc.yml
Normal file
@ -0,0 +1,10 @@
|
||||
title: Sieve of Eratosthenes
|
||||
url: http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
|
||||
|
||||
desc:Generate primes from 2 to 100
|
||||
solution: Do i need to say more
|
||||
|
||||
solutions:
|
||||
solve.c:
|
||||
desc: ANSI C solution (Tested with TCC)
|
||||
language: c
|
22
Generic/Seive/solve.c
Normal file
22
Generic/Seive/solve.c
Normal file
@ -0,0 +1,22 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void main( )
|
||||
{
|
||||
unsigned char primes[100];
|
||||
int p;
|
||||
int j;
|
||||
memset(&primes, 1, 50 );
|
||||
for( p = 2; p<=10; p++) {
|
||||
if (primes[p]) {
|
||||
for(j = p*p; j <= 100; j+= p){
|
||||
primes[j] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
printf( "Primes:%d\n", sizeof(primes)) ;
|
||||
for(p=0;p<sizeof(primes);p++) {
|
||||
if(primes[p]) {
|
||||
printf( "%d\n",p);
|
||||
}
|
||||
}
|
||||
}
|
23
ProjectEuler/026/desc.yml
Normal file
23
ProjectEuler/026/desc.yml
Normal file
@ -0,0 +1,23 @@
|
||||
title: Find the value of d < 1000 for which 1/d contains the longest recurring cycle in its decimal fraction part.
|
||||
url: http://projecteuler.net/problem=26
|
||||
|
||||
desc: |
|
||||
A unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with denominators 2 to 10 are given:
|
||||
1/2 = 0.5
|
||||
1/3 = 0.(3)
|
||||
1/4 = 0.25
|
||||
1/5 = 0.2
|
||||
1/6 = 0.1(6)
|
||||
1/7 = 0.(142857)
|
||||
1/8 = 0.125
|
||||
1/9 = 0.(1)
|
||||
1/10 = 0.1
|
||||
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.
|
||||
Find the value of d < 1000 for which 1/d contains the longest recurring cycle in its decimal fraction part.
|
||||
|
||||
solution: Bruteforce
|
||||
|
||||
solutions:
|
||||
solve.php:
|
||||
desc: Basic Solution - needs BCMath
|
||||
language: php
|
20
ProjectEuler/026/solve.php
Normal file
20
ProjectEuler/026/solve.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
define('MAX',1000);
|
||||
|
||||
$max_len = 0;
|
||||
for($div = MAX; $div > 2; $div--) {
|
||||
$result = bcdiv('1',(string)$div,2000);
|
||||
|
||||
for($len = 2; $len < 1000; $len++) {
|
||||
if(substr($result,10,$len) === substr($result,10+$len,$len)) {
|
||||
if($len > $max_len) {
|
||||
echo "Div: ".$div. " Len: ".$len."\n";
|
||||
$max_len = $len;
|
||||
$max_div = $div;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
echo $max_div;
|
13
ProjectEuler/026/solve.rb
Normal file
13
ProjectEuler/026/solve.rb
Normal file
@ -0,0 +1,13 @@
|
||||
DIGITS = 1000
|
||||
|
||||
max = 10 ** (DIGITS-1)
|
||||
fcurrent = 1
|
||||
fprev = 1
|
||||
term = 2
|
||||
while fcurrent < max do
|
||||
term = term + 1
|
||||
fnext = fcurrent + fprev
|
||||
fprev = fcurrent;
|
||||
fcurrent = fnext;
|
||||
end
|
||||
puts term
|
20
ProjectEuler/027/desc.yml
Normal file
20
ProjectEuler/027/desc.yml
Normal file
@ -0,0 +1,20 @@
|
||||
title: Quadratic primes
|
||||
url: http://projecteuler.net/problem=27
|
||||
|
||||
desc: |
|
||||
Euler discovered the remarkable quadratic formula:
|
||||
n² + n + 41
|
||||
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.
|
||||
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.
|
||||
Considering quadratics of the form:
|
||||
n² + an + b, where |a| < 1000 and |b| < 1000
|
||||
where |n| is the modulus/absolute value of n
|
||||
e.g. |11| = 11 and |-4| = 4
|
||||
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
|
||||
|
||||
solution: Bruteforce
|
||||
|
||||
solutions:
|
||||
solve.php:
|
||||
desc: Basic Solution - needs BCMath
|
||||
language: php
|
32
ProjectEuler/027/solve.php
Normal file
32
ProjectEuler/027/solve.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
function is_prime($prime) {
|
||||
if($prime == 1)
|
||||
return true;
|
||||
if($prime == 2)
|
||||
return true;
|
||||
$sqrt = sqrt($prime);
|
||||
for ($i = 3; $i <= $sqrt; $i+=2){
|
||||
if ($prime%$i == 0) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
$high = 0;
|
||||
$max_primes = 0;
|
||||
for($a=-999; $a<1000; $a++) {
|
||||
for($b=-999; $b<1000; $b=$b+2) {
|
||||
|
||||
$n=0;
|
||||
while(true) {
|
||||
echo $n*$n + $a * $n + $b . "\n";
|
||||
if(!is_prime($n*$n + $a * $n + $b)) {
|
||||
if($n > $max_primes) {
|
||||
$max_primes = $n;
|
||||
echo "max: $n a: $a b: $b\n";
|
||||
}
|
||||
break;
|
||||
}
|
||||
$n++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
13
ProjectEuler/027/solve.rb
Normal file
13
ProjectEuler/027/solve.rb
Normal file
@ -0,0 +1,13 @@
|
||||
DIGITS = 1000
|
||||
|
||||
max = 10 ** (DIGITS-1)
|
||||
fcurrent = 1
|
||||
fprev = 1
|
||||
term = 2
|
||||
while fcurrent < max do
|
||||
term = term + 1
|
||||
fnext = fcurrent + fprev
|
||||
fprev = fcurrent;
|
||||
fcurrent = fnext;
|
||||
end
|
||||
puts term
|
5
nbproject/private/private.properties
Normal file
5
nbproject/private/private.properties
Normal file
@ -0,0 +1,5 @@
|
||||
copy.src.files=false
|
||||
copy.src.target=
|
||||
index.file=
|
||||
run.as=SCRIPT
|
||||
url=http://localhost/codingtests/
|
7
nbproject/project.properties
Normal file
7
nbproject/project.properties
Normal file
@ -0,0 +1,7 @@
|
||||
include.path=${php.global.include.path}
|
||||
php.version=PHP_54
|
||||
source.encoding=UTF-8
|
||||
src.dir=.
|
||||
tags.asp=false
|
||||
tags.short=true
|
||||
web.root=.
|
9
nbproject/project.xml
Normal file
9
nbproject/project.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.php.project</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/php-project/1">
|
||||
<name>codingtests</name>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
Reference in New Issue
Block a user