From fa2c5b27d6b5919b792e973f14e8b1f206ce3ec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Javier=20Couti=C3=B1o?= Date: Fri, 23 Jan 2015 12:48:59 -0600 Subject: [PATCH] Agregando problemas resueltos --- 01 - Multiplos 3 y 5/p01 | Bin 0 -> 18256 bytes 01 - Multiplos 3 y 5/p01.cpp | 29 +++++++++ 02 - Serie Fibonacci/p02 | Bin 0 -> 8192 bytes 02 - Serie Fibonacci/p02.cpp | 41 +++++++++++++ 03 - Factor primo/p03 | Bin 0 -> 8344 bytes 03 - Factor primo/p03.cpp | 37 ++++++++++++ 04 - Producto palindromo/itoaEjemplo.cpp | 17 ++++++ 04 - Producto palindromo/p04 | Bin 0 -> 9704 bytes 04 - Producto palindromo/p04.cpp | 85 +++++++++++++++++++++++++++ 05 - Multiplo menor/p05 | Bin 0 -> 8384 bytes 05 - Multiplo menor/p05.cpp | 40 +++++++++++++ 06 - Suma de diferencia de cuadrados/p06 | Bin 0 -> 8632 bytes 06 - Suma de diferencia de cuadrados/p06.cpp | 42 +++++++++++++ p01.cpp | 21 +++++++ 14 files changed, 312 insertions(+) create mode 100755 01 - Multiplos 3 y 5/p01 create mode 100644 01 - Multiplos 3 y 5/p01.cpp create mode 100755 02 - Serie Fibonacci/p02 create mode 100644 02 - Serie Fibonacci/p02.cpp create mode 100755 03 - Factor primo/p03 create mode 100644 03 - Factor primo/p03.cpp create mode 100644 04 - Producto palindromo/itoaEjemplo.cpp create mode 100755 04 - Producto palindromo/p04 create mode 100644 04 - Producto palindromo/p04.cpp create mode 100755 05 - Multiplo menor/p05 create mode 100644 05 - Multiplo menor/p05.cpp create mode 100755 06 - Suma de diferencia de cuadrados/p06 create mode 100644 06 - Suma de diferencia de cuadrados/p06.cpp create mode 100644 p01.cpp diff --git a/01 - Multiplos 3 y 5/p01 b/01 - Multiplos 3 y 5/p01 new file mode 100755 index 0000000000000000000000000000000000000000..9b75cb7b336206ee4cc055b805c5cfce74e0ea9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D~ueTmMt~oR4k1QonH&{cRU2gsq(EM26i4lQUGR**9G6)sB2{jEwN$i*2K!?75DI)C*1 X&-tw)MBoT +#include + +using namespace std; + +int main() +{ + int res = 0; + + for (int i = 1; i < 1000; i++) + { + res += (i % 3 == 0 || i % 5 == 0) ? i : 0; + } + + printf("Resultado: %i\n", res); + + return 0; +} \ No newline at end of file diff --git a/02 - Serie Fibonacci/p02 b/02 - Serie Fibonacci/p02 new file mode 100755 index 0000000000000000000000000000000000000000..b0a3b7585a76468819404d44a53248e6f372f2a0 GIT binary patch literal 8192 zcmcIpeQX@n5r2E@`$(Kz&W3*2wv2;_#u?S?}Gg?+)(6 zy4wqJ1Zq+fBojhYTA_Z@RE;YB=pXq5QT{1$8WgJ%qM<4hYKxSjQaMm6BSPd-$aUtu zH|M?e86j02>2}`y-pstWv$Ol=z58~2V5d(}7?F?N&rrJDq;p7I8Pjj&qQtha5YyS6 zOk)8+{P5Fx4|35WJ}F%j4@o^0coVjL67cDwA^9pHG2%2s9Q&KwV)7*GngY1 z+TmPhW&dn&7$lShAC~jT(0rsFif9*+6OV+1KJmHvgAx$kAKn}OR!M)Wd^$)d>&RFi zzs_;gMcVhilfw2JI4I|O9pB6)#)y;MH^5GsNR2ON5!v05%O<)vcjQv-xon|wr2WX2 z?)L7@(Q+}mk>|`T3m8&l@i6C@Lu7+Mr^NBK!RJV{#f7`|br(*#i8jXgKSRbz|IhpyGfqr8{%L#w z#`x=@i{w%8>OIeZN_E|{a9y@qhZf2i?7VuV3bgJ!DC1PFUgq*qlyM4ICqeG|sDI+E zL&n5=#`xc7_6_z=O`Zwp%$T~+$=TE;zs{zoK=InhvekWzy=uaQ4;t+c12e{F!^Xt> zhgZIe!{IbrhR$P0^$I9Ig&-TcID!-<`8Di6XdM3+cW~i`3J#2k8RNqA4nw(QymiA_ zUh~#W-j=OKKYaXS+uv%^7^}1#1jFe9Ol;_q|22S=PcGv9pAW$Y#~9ziD*g|@4|X+Y zAEQC_^3c_zV1sRlaA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@ +/* +Even Fibonacci numbers +Problem 2 +Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: + +1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... + +By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. + +by:dbk + +*/ + +#include + +#define LIMITE 4000000 + +int main() +{ + + int i; + unsigned int a = 1; + unsigned int b = 1; + unsigned int res = 0; + unsigned int tmp = 0; + + do + { + + tmp = a; + a = b; + b += tmp; + + if (b % 2 == 0) res += b; + + }while(b < LIMITE); + + printf("\nResultado final: %ld\n", res); + + return 0; +} \ No newline at end of file diff --git a/03 - Factor primo/p03 b/03 - Factor primo/p03 new file mode 100755 index 0000000000000000000000000000000000000000..9d62beda5f6d08a9d4a864bf349020afe9ae19e6 GIT binary patch literal 8344 zcmcIpYiwM_6`p(7_O5NRwnHFK$O@7+5WKdNU^xjPcl}7NQ|Hmd0nrk!*Spu=h4rqr z4>yjWI5i-)A=H7Yg+3&HR24t^1GN&3DgjAD9a{BaB%($wm7n*v@vfd7x~2&hUEC|knyN4)no%{?Sd?ahgyvW~t>HNaY+k0ivS zzBa4!W?vsHvK`&0`Vr&)C?1)_GZoKN{;cQv4<`tZkH$v7RjR&Kx&e!9gOuo$>715x z0c_vJY*gmG%E4(Z)nPnLFHgxUIFZbyF~t z3T}}7CqJ6IoqG;S2G2(T7PY+uKYEr_{);`AYF-zwt(i$imOlRD4ac8(^|{{=mw(7! zw;Y4#;xgXUpFkOW^#b^Fz{}OMaRL9m3*Z9tl*vXT>(|rVvsA}cksYJLOBZG#Ykx&Hb>-5Ow0}-Eb>Y$}*exG+=ih$F%>UgS ze{W`AZ}-_#Q&omA&z|m+>g;5tA*Rp5@sokN)ty3|{60E-&}^K5GRHsloB4|)D^F5$ z)Xj!NZ&1PP1vo!Jpg449fF#KF>r{TwJo*n=!Rc!rRAA<3%+u4`O>NSA`&#yIF!c>H|HOF*Uaap%#&w7$X}#a$joSQ zrC~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rl%U47|Q*eR4gwDf|UjJztji{C0z? zevVi;D%~jYGT+-sI-AMnaI%fyre{~jeygYZKre2Z<}Q@1?2r|qE2WI!o1`MhvZ5(# zFp=sHC#)zAz8Nc=J1nqc4kzra9Syd&wzi<=GENrl-Of&IVRucB3TN+*=7xqwK`F8< z+VV?WIS8_>9s5JOyR5D~ope1WN1*aMd-k@6daS)Wb{y#HwR%JCJzeBcQdP7Rkk@R& z>U>~NXm@vqpb)^h_!7=#m|+y(eW{zVNG2zTB9!a(T-nL6W!}x2tNQ^heNA z^ncW}1L0M{w^oU6I2i@FcOvpFmfK+<)GzQkPU8FUK(RCO{GK!1f=n@=?nDTqp>re z&+GRAqdNiSa~!u$T@<{c_^jOXM~62$(=(srz4MBXGno|bKl`zM1f_IGz&6K)(~2K( z==1uoU~vQ)np5U;{OD5?&Ew?u-Q#~k@!M5}9A^d;-&8p9DaLT~p9My9BG1Xt9FN8n z-yJzA7@m&gp^Et&w@xTWL;0~nOZ&7@vCv2{J()qQ_XxnAMpQx zJTbgJxqV&-@4MRP|5r?PvB>^#lfpLZ%Rr0!&*zPOir=hwteD4|o=-8K$+&F?;AqKLMGJ0zYX~f`0={qeSyAj<=THiU7T-rRqpDJ_z&+o7}Wp( literal 0 HcmV?d00001 diff --git a/03 - Factor primo/p03.cpp b/03 - Factor primo/p03.cpp new file mode 100644 index 0000000..2181cec --- /dev/null +++ b/03 - Factor primo/p03.cpp @@ -0,0 +1,37 @@ +/* + +Largest prime factor +Problem 3 +Published on Friday, 2nd November 2001, 12:00 pm; Solved by 256800 +The prime factors of 13195 are 5, 7, 13 and 29. + +What is the largest prime factor of the number 600851475143 ? + +By: dbk + +*/ +#include + +#define CALCULAR 600851475143 +#define MAX 1000000 + +int main(int argc, char const *argv[]) +{ + + long res = 0; + long valor = CALCULAR; + + for (int i = 2; i < MAX; i++) + { + while ( valor % i == 0) + { + valor /= i; + res = i; + } + + } + + printf("Mayor factor primo: %ld\n", res); + + return 0; +} \ No newline at end of file diff --git a/04 - Producto palindromo/itoaEjemplo.cpp b/04 - Producto palindromo/itoaEjemplo.cpp new file mode 100644 index 0000000..6c55ff8 --- /dev/null +++ b/04 - Producto palindromo/itoaEjemplo.cpp @@ -0,0 +1,17 @@ +#include +#include + +int main () +{ + int i; + char buffer [33]; + printf ("Enter a number: "); + scanf ("%d",&i); + itoa (i,buffer,10); + printf ("decimal: %s\n",buffer); + itoa (i,buffer,16); + printf ("hexadecimal: %s\n",buffer); + itoa (i,buffer,2); + printf ("binary: %s\n",buffer); + return 0; +} \ No newline at end of file diff --git a/04 - Producto palindromo/p04 b/04 - Producto palindromo/p04 new file mode 100755 index 0000000000000000000000000000000000000000..ed26c561c7cfb812b16bd9907cbc976c2a0096c0 GIT binary patch literal 9704 zcmcIq4QyN2b-s@jDO$2f%61wjc51eXJExu~OI8HOzoaDElp{NuBROtn=ZPYpBsTmJ z$VXWY(8ihUEQI3BTGK4evds&!HNbwF0fUikL88QMjAFsy4qXwfTM-mXA=l}wu5KVS zX}Is)cMtXWOclX^U5NLb^WAgKJ@>wQ-#hO0D{L zZF)y{TX$Eum=AZ#_(_lE?!e(;X~FXmf<$qy!;h{dwWr;G`Tko!^mY!8oqY1^p7hpB z1HXKhZ21TFQg1*4K7R^+0>sFe} zZlUYr*?dkfnu&s`>q0*`r5`cI(?!!L^kx#pqEQrj|Ii^lWfT-Vbf`Cz&ly9B(TriW z)onpPS*r_hUcEEi8NLUj zu@)@V`~!U$NG%|}S4(63&R@i?jf1Bz|~izypv=K{ptnC9Y5c2dH9y>aI`OT0dmydcQV&R)myfGHo)F;HN-@<@~<83d4#AlZL@$&mq8(xJs zIgHj5Z%{+!Jt&_cP@K3lMkUPh>(o9RfBe6tgEv2M!$G{f7=LqNUtD`T{=HAkTdLlg z*;`-}`H}sf-ZSS72~lbthT%dEft`5U^Ho6FFD}viyb;F@Fg~+SlswnI2D_@WpOZo5 z%89Fw!iIQUfl&D?AH>V0_b$girU|?pTe8R^MSeMU!y>Y6HuiDgT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UHATQJmwy3UZyrdap8tQB`Zuo=dEkLKo$J&3G;nkLlwE3d z*5@6-L*nN3wgvba%#Sl^+$(X4wzeEm`gB@G#meA?7*#lbpOB5H(!fJ3*y!{M_*2S{ zGeP_-iQjyG_&bT)94q$93jRL;-YS;wCk;yfqZRxFFu>5w?#11}gLUSU-cr`o(Z3IP zD>6D>x2*D@!Y?@XdrJCg5p*0$g|cWWCh(wb{adKO^T5Jiarika@tga7O8Mv1??vTk zPU3a$=gERuG?C7PlQ^k9*n31D=zm}cC+5osiYg8(L*skcDRp@`Q-={e_-JLp6Gyn|Ni|C#D?^tXwN{5G-_NSKePk#bAizNzH~Tx zsJ~ZGf?*xpuaHJsC;gF#{X}1#_a}=bIY7YbX;%c2bw45cE>$RA z{AlcKk9Sj9j-sZsHSVAD&tvMqjh?6W;+(&S(MV@wY|nXWPz{vtr5r!&F?|H~bk@c) z=d)XseMoigj9|l|7G>`*)82jI!@h4*9%rMA=U(oa`w#a@s!)jOK*m zqr!RgyUN~~@hR9+Moq^zcKd3+tpXmYYFbQC$xP|Yz;4ga?-6C+$p@znJ0*(e9rm2R zKcfb^iWL=g#(zQC^Zaw3e?i$h_n*`LWrsb#5Ab*TKGiQ1r~O5Tef7OT1>WUYuzda4 z-#i#UemqT_PxAjWIQ5^aYiGyz0$>O19kp+g~Z|D1QnKc)SD!j{$^+w*%3 z|6c`f3|^nyKd+ykIQr-B&4aYqQCQ!SmSx7Tp}`(Mzb742_7OHzl$iq zHR=P+PTp9`xzqm673>FSQKBqZq*^=eJ65poQWO7N)zV^|_Is4QbDZxe`&owpi%jvR zU%htrt{zkmjyNl-Mu#Zp-Z4c|^8(IXsVu66|9SA8`0@JT=K|d(c +#include + +using namespace std; + +#define MAX 10000 + +bool validPalindromic(int); +bool validPalindromicApuntador(int); + +int main(int argc, char const *argv[]) +{ + + int a = 1; + int b = 1; + + int c = 0; + + int res = 0; + + do + { + a = 1; + do + { + c = a * b; + res = (validPalindromicApuntador(c) && c > res) ? c : res; + + }while(a++ < MAX); + }while(b++ < MAX); + printf("Resultado final: %d\n", res); + return 0; +} + + +bool validPalindromic(int valueCheck) +{ + bool flagValid = true; + char buffer[30]; + int counterDsc = 0; + int counterAsc = 0; + int sizeStringNumber = 0; + + //Convierte el entero a una cadena + sprintf(buffer, "%d", valueCheck); + counterDsc = sizeStringNumber = strlen(buffer); + while(sizeStringNumber > counterAsc) { + flagValid &= (buffer[counterAsc++] == buffer[--counterDsc]) ? true : false; + } + + return flagValid; +} + +bool validPalindromicApuntador(int valueCheck) +{ + char *ptrAsc; + char *ptrDsc; + char buffer[30]; + bool flagValid = true; + + //Convierte el entero a una cadena + sprintf(buffer, "%d", valueCheck); + ptrAsc = buffer; + ptrDsc = &buffer[strlen(buffer)]; + + while(ptrDsc >= ptrAsc) { + flagValid &= (*(ptrAsc++) == *(--ptrDsc)); + } + return flagValid; +} + +/* + TEST DIR MEM Apuntadores + printf("mem1:\t%p\n", ptrAsc); + printf("mem2:\t%p\n", ptrDsc); +*/ \ No newline at end of file diff --git a/05 - Multiplo menor/p05 b/05 - Multiplo menor/p05 new file mode 100755 index 0000000000000000000000000000000000000000..cd3e51519154d913dddd9d20729b1cb2243709c9 GIT binary patch literal 8384 zcmcIpeQaCR6~FI2J9e7Zagr8NTIho|EYQVC`Vpn2AJ0kLIwfgKo4^p17sr0F4UQez z&soxq5tJ5cb!BC+2{yD<(}b#Ne@xrdRr_P4Dx^%BrlP@w_8~Ya1n zJ&yh2pi0xO;&<-(-Sa#5-23i(_q>~@0zErqNn%uFwvC~7-l1{Gxx?QrgP?(XLdnhzB;?0YHv@LpoO@%gr0{S)6f<34;<|JA>K{HpgyckV|n z{h)f& zKLrd+`=S9ZaSag%fv*YN1$DfSR0fLhV*6MTPHPi6!O0KY!K2PMoGJ?*o-&=Ycmsly zue;BZM@!~6{t`^`4ZntK^(qZ&sK>DJ(o7yo!_QF1P%fS4`cF{D5H3xD-uhv8?ybjy zxqk#F-@CH6ulwB8`3j8%&z%|I;@q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-yCm%+rS_GK_M=jKQDNUI#j6714AX9VQP?s#2PlW%Quux<<|wf1Q+`m2*Rv6kH?gl`DY|=h&n8(R*-y!N4CGaCQKVRYa{C<7HKcz4) z2}kQWUgmupPMaAs3tzxtI1$>_xlixu-rol&Qga7Sx;d%GX+(T&ZEdaKxr~vHTer0l>#(_|$C?GfgW#BNHcR;Y^kfg$dJ}Iojh{%e)gfoBJ<4|Jwt-MdC?4n=xPz zXi7Jy^q^2L8icMxTVbjqnUo$2B_nv8Xq^S(NN{>UhqQ-=Vkj;;wL+jPe3c4Es#!m;jG}R z7JXj)0%ixHf^$lI${*cgqVYQp3-xaw{~>5Y(+)I(Lgyo@;0G<3^D)P;^Pd9@=e0uE zQ9c?Ie0%03U}4Qz&c>&_^|&z93YJ#ID|C`Cf?nJ|{om}o;KP?@Ng*DAKd|vB4}Mz= zsFDnYw8wu!@Tr@b3XNON2!1u!<}P;rNod0OiBEYo{r_ph9F^DX{8KhQ<=>6?P(t~{ z5``<>KLVzpf@@SPw?dw-3PZcSUH=1cag4;Le5vs!`R@W3$4`99Ut4aHkEcC2)x@Xo z1Nwg2p+Gv-7tKzJ2~a7kpeF#fA7JYoL+t zU9sIoaUdTgL(ync`P|dHqnO_!UOdOe!oLd|*TIk09qkMFek<4ilsItTWOHus|G&xh BE2;nh literal 0 HcmV?d00001 diff --git a/05 - Multiplo menor/p05.cpp b/05 - Multiplo menor/p05.cpp new file mode 100644 index 0000000..1192fe9 --- /dev/null +++ b/05 - Multiplo menor/p05.cpp @@ -0,0 +1,40 @@ +/* +Smallest multiple + +Problem 5 + 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. + + What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? +*/ +#include + +using namespace std; + +#define MAX_VALUE 20 + + +int main(int argc, char const *argv[]) +{ + int i = 0; + int incMultiplos = 0; + + bool flgValid = true; + + do + { + i++; + flgValid = true; + incMultiplos = MAX_VALUE; + + while(incMultiplos > 0) + { + flgValid &= (i % incMultiplos-- == 0); + if (!flgValid) break; + } + + }while(!flgValid); + + printf("i: %d \t%x\n", i, flgValid); + + return 0; +} \ No newline at end of file diff --git a/06 - Suma de diferencia de cuadrados/p06 b/06 - Suma de diferencia de cuadrados/p06 new file mode 100755 index 0000000000000000000000000000000000000000..ccc3789c7aef5c1978a29bc5f7e9034ddd76cf1e GIT binary patch literal 8632 zcmcIpeQZPe@rWXRI3pcblSAhX;ax(6-{jwN~x-+Awzcl|`Td$X=-f{QLT3gVhQK?&Kl5Z4+dtFSiV6+v;Q z@QW%S9$Z1$L)30DEhy7Wy-Lmn>ZZ1?06l0o6kTL4Ql*XGZLDjVB+iC!&0zOh9 zJ@WM()&GvS7aZ|69aMe{vp-6YSkfC)dSgnS>7@S@CuR;D`?r5uLK0 zq;f5Q?flS+Q~T9wTj15|plmQ*W5a?e>wOb?voaZPN+wdd15F3o zTANze1hVPCD(OGT(b{dP}()!J-SDl zNPzPC=59^QpgVg)_S*eNRX;&?zh3MgtLY_JJ}WBZB`<1wC8cntIN;(f!As>EN^p*C z(rGNg)uSOzMMgjIMvi&rRry8aXu#bs$^)KUx=@h(W#Va(F1!xD<q+)@s>W{bI5s$3MKG3;v7T ztUXX1Pr#zU3aJl}T@b!o^iJo92A3lG%zG2(>@t@q7 znCP!x_6`eOxm^FPQp)GXX-wf)()ro;0 z2Ymsw8}up6`p2Mg+?}^U{{UKtD5m!@746V2p&e+@7S>gJpVO)v2w#LN2>p9VK$Xh! zLM%Z)$rr9qOzb3CU&Cf!X0Jpw|$h9~uonN|Al zF|yqk2mBKJHL1Vd*YKc4A;#7Fnb)pY3Gn@|R{VTLd)0gyk0_q~=JBve$ih5skDQNJ z$s;T!&*NTF{1r7nrT%{>#eB^%(pBYWm5Q5N6unDPhq&0%(Xr0ItkdjEL{t7Xfwh5_ zrk1tK?Uu8%EwH+&Wi@r8CGLeOdll?8q@99_d}?H?yt)&i>6VaJdkNItqxvf;>fY)n z(XDIV7!ket*F@aa$0S%qPoA!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x%ii$ed?-vez&ePAS@vk`a`Tj9n zK*NVig=;Z? +#include + +using namespace std; + +#define LIMITE_RANGO 100 + +int main(int argc, char const *argv[]) +{ + + int i = 0; + int res = 0; + int valSum = 0; + int valPow = 0; + + while(i++ < LIMITE_RANGO) + { + valSum += i; + valPow += pow(i, 2); + } + + res = pow(valSum, 2) - valPow; + printf("Resultado final: %d\n", res); + + return 0; +} \ No newline at end of file diff --git a/p01.cpp b/p01.cpp new file mode 100644 index 0000000..2d23e07 --- /dev/null +++ b/p01.cpp @@ -0,0 +1,21 @@ +#include + +using namespace std; + +int main() +{ + res = 0; + + for (int i = 10; i > 0; i--) + { + + if (i % 3 == 0 || i % 5) + { + res += i; + } + + } + + cout << res << endl; + +} \ No newline at end of file -- 2.0.0