True Posted September 27, 2003 Posted September 27, 2003 I saw this somewhere, and it took a while to compute the answer (not long to write code to solve it), but its pretty easy... Okay, you have x and y. x is from the range of 0 to 1000, y is also from 0 to 1000. You need to multiply all sets of numbers, in both directions (ie. x*y AND y*x, like 50*4 and 4*50, even though both give the same product) and add together those products that are palindromes. What is the final sum? Extra credit is the answer this question using products in only one direction (ie 50*4, NOT 4*50, since that same number set has been used already). Programmatically speaking this is really easy, just one more check EDIT: I will include source to find this answer as soon as someone posts the answer. 2ND EDIT: Oops, said it completely wrong... fixed the question ...to all those who have doubted me...come see me now... Asus A7N8X Deluxe r2.00 / UBER 1007 BIOS Modified AthlonXP 2100+ (1.73ghz) @ 200x11.5 (2.30ghz, ~3000-3200+) 1.85vcore (48c/load diode), SLK-800w/TTSFII 512mb PC3200 DualChannel 11-3-3-2, 2.7vdimm GFFX5200128bit128MB (295/432) 52x32x52CDRW, 160gb Hitachi 7K250 8mb WinXP / Gentoo Dell Inspiron 8000 in good shape, Compaq Presario 1200 12XL500 rigged to all hell 8000: DVD, CDRW, 384mb, 5400rpm 60gb 16mb cache, 1400x1050 15" 1200: CD, 192mb, 20gb, 1024x768 14" At least 6 hours battery time with both Dell C Bays ;], 175w DC to AC car inverter MSI CB54G Cardbus 802.11g, Dell Truemobile 1150 Orinoco Gold 802.11b, modded Tripmate GPS (always on/external power) Custom Spaghettios 26oz Waveguide Directional Tin Can Antenna Don't forget to chalk..
True Posted September 27, 2003 Author Posted September 27, 2003 No takers? ...to all those who have doubted me...come see me now... Asus A7N8X Deluxe r2.00 / UBER 1007 BIOS Modified AthlonXP 2100+ (1.73ghz) @ 200x11.5 (2.30ghz, ~3000-3200+) 1.85vcore (48c/load diode), SLK-800w/TTSFII 512mb PC3200 DualChannel 11-3-3-2, 2.7vdimm GFFX5200128bit128MB (295/432) 52x32x52CDRW, 160gb Hitachi 7K250 8mb WinXP / Gentoo Dell Inspiron 8000 in good shape, Compaq Presario 1200 12XL500 rigged to all hell 8000: DVD, CDRW, 384mb, 5400rpm 60gb 16mb cache, 1400x1050 15" 1200: CD, 192mb, 20gb, 1024x768 14" At least 6 hours battery time with both Dell C Bays ;], 175w DC to AC car inverter MSI CB54G Cardbus 802.11g, Dell Truemobile 1150 Orinoco Gold 802.11b, modded Tripmate GPS (always on/external power) Custom Spaghettios 26oz Waveguide Directional Tin Can Antenna Don't forget to chalk..
RobZGod Posted September 28, 2003 Posted September 28, 2003 And i thought 2+2 was hard... So is this where im supposed to put a witty comment
Guest Posted September 28, 2003 Posted September 28, 2003 i know the anser to 2+2 is................just ask someone
RobZGod Posted September 28, 2003 Posted September 28, 2003 i know the anser to 2+2 is................just ask someone Gimme a clue, please? So is this where im supposed to put a witty comment
Iam A. Spammer Posted September 28, 2003 Posted September 28, 2003 In reply to the top post: 7 ! Is this really my name or a reference to an ability of mine? FREE PRON
Guest Posted September 28, 2003 Posted September 28, 2003 uh uh uh uh uh uh uh uh uh uh uuuuuuuuuuuuuuuuhhhhhhhhhhhhhhh what does this+ sign mean
Nub Posted September 28, 2003 Posted September 28, 2003 uh uh uh uh uh uh uh uh uh uh uuuuuuuuuuuuuuuuhhhhhhhhhhhhhhh what does this+ sign mean MODS lock this post it is not needed "Those who give up essential liberties for temporary safety deserve neither liberty nor safety."
Kent747 Posted September 28, 2003 Posted September 28, 2003 gimme a minute i'll give it a shot edit ok here's what i got, thoguh i don't see the significance 509033471 here's the code... #include #include #include bool isPalindrome(int n){ char str[10]; char temp[10]; itoa(n,str,10); strcpy(temp,strrev(str)); strrev(str); if (strcmp(temp,str)==0) { cout< return true; } return false; } void main(){ int sum=0; for (int x=0;x<=1000;x++){ for (int y=0;y<=1000;y++){ if ((x!=0)&&(y!=0)&&isPalindrome(x*y)) { cout<<"X="< sum+=x*y; } } } cout< cout<<"done!"; char temp; cin>>temp; } used 2 strrev calls because it actually changes the string... also the checks that X!=0 and y!=0 does not affect the final answer but saves calculation time I think the extra credit answer is 255010259 (added a check that x<=y in the main condition) Kent Kent Simon's Amazing Cross Language Hello World Program!! #include #define print printf#define caller void main(){#define ref }caller ;print ("Hello World!\n");ref;
Guest Posted September 29, 2003 Posted September 29, 2003 hey im having a special conversation with rob
True Posted September 29, 2003 Author Posted September 29, 2003 Correct on both You already have your C out there... no need for the PHP equiv... besides, mine is quite bloated, I got SOO bored last night I added display of iterations (displays the value at the end of every xxx amount of runs) and something else... damn... all over some stupid math problem... I dont know what so many people think is hard about math... what did that take, 10 minutes if not less? CPUtime probably took the longest chunk of that 10 minutes... ...to all those who have doubted me...come see me now... Asus A7N8X Deluxe r2.00 / UBER 1007 BIOS Modified AthlonXP 2100+ (1.73ghz) @ 200x11.5 (2.30ghz, ~3000-3200+) 1.85vcore (48c/load diode), SLK-800w/TTSFII 512mb PC3200 DualChannel 11-3-3-2, 2.7vdimm GFFX5200128bit128MB (295/432) 52x32x52CDRW, 160gb Hitachi 7K250 8mb WinXP / Gentoo Dell Inspiron 8000 in good shape, Compaq Presario 1200 12XL500 rigged to all hell 8000: DVD, CDRW, 384mb, 5400rpm 60gb 16mb cache, 1400x1050 15" 1200: CD, 192mb, 20gb, 1024x768 14" At least 6 hours battery time with both Dell C Bays ;], 175w DC to AC car inverter MSI CB54G Cardbus 802.11g, Dell Truemobile 1150 Orinoco Gold 802.11b, modded Tripmate GPS (always on/external power) Custom Spaghettios 26oz Waveguide Directional Tin Can Antenna Don't forget to chalk..
Kent747 Posted September 29, 2003 Posted September 29, 2003 cpu time took about 1 -2 seconds for me coded in about 5 mins try compiling it.. i thinkyou'll find that C++ is quite fast also limiting screen displays really improves speed, as I/O is terribly slow Kent Simon's Amazing Cross Language Hello World Program!! #include #define print printf#define caller void main(){#define ref }caller ;print ("Hello World!\n");ref;
True Posted September 29, 2003 Author Posted September 29, 2003 I know Cpp is fast... learned when I was 11 but because of foster care and constant moving, I didn't have time to keep up with it. Because of such past experience I easily picked up PHP - literally, in 3 minutes. Now that I am doing PHP I am fine with it, with almost no need for c++ in my life at this moment (or at least creating something new), and I do know reducing such wasteful IO can increase time, maybe it was just the way I coded it or inefficiencies within the operations / functions I used that made my compute time take longer. I dont know... my machine takes about 10 seconds to compute, my webserver takes a minute or so ...to all those who have doubted me...come see me now... Asus A7N8X Deluxe r2.00 / UBER 1007 BIOS Modified AthlonXP 2100+ (1.73ghz) @ 200x11.5 (2.30ghz, ~3000-3200+) 1.85vcore (48c/load diode), SLK-800w/TTSFII 512mb PC3200 DualChannel 11-3-3-2, 2.7vdimm GFFX5200128bit128MB (295/432) 52x32x52CDRW, 160gb Hitachi 7K250 8mb WinXP / Gentoo Dell Inspiron 8000 in good shape, Compaq Presario 1200 12XL500 rigged to all hell 8000: DVD, CDRW, 384mb, 5400rpm 60gb 16mb cache, 1400x1050 15" 1200: CD, 192mb, 20gb, 1024x768 14" At least 6 hours battery time with both Dell C Bays ;], 175w DC to AC car inverter MSI CB54G Cardbus 802.11g, Dell Truemobile 1150 Orinoco Gold 802.11b, modded Tripmate GPS (always on/external power) Custom Spaghettios 26oz Waveguide Directional Tin Can Antenna Don't forget to chalk..
RobZGod Posted September 29, 2003 Posted September 29, 2003 uh uh uh uh uh uh uh uh uh uh uuuuuuuuuuuuuuuuhhhhhhhhhhhhhhh what does this+ sign mean MODS lock this post it is not needed Please, please, have some humor. Lighten up. The worlds boring enough as it is, what with the seriousness of work, and of new fears of terrorists and all that. We need someone to laugh at, cant it be me and phil? So is this where im supposed to put a witty comment
Iam A. Spammer Posted September 29, 2003 Posted September 29, 2003 gimme a minute i'll give it a shotedit ok here's what i got, thoguh i don't see the significance 509033471 Damn, I had a feeling that 7 wasn't right! Is this really my name or a reference to an ability of mine? FREE PRON
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now