« first day (1060 days earlier)      last day (3886 days later) » 

user1174868
10:01 PM
I am goign to take a break from this code, been at it for too long
 
@TemplateRex that won't perform.
 
@sehe two iterators at both ends, incrementing / decrementing towards each other? not the best algo?
 
Ell
Hmm I wonder how you would check a parameter pack for palindrome-ness
 
@TemplateRex why on earth use iterators. I mean, I can see how you can treat the numbers as strings, but then you have the "hard" problem of factoring the palindromes. Best to generate the products (descending) and then check for palindromity
 
Ell
That doesn't sound cache friendly
but what do I know
 
10:05 PM
@sehe generic template<class BiDirIt> bool is_palindrome(BiDirIt first, BiDir last)
why restrict to strings?
 
@TemplateRex Irrelevant. Any sequence is necessarily not an arithmetic type, and you still have the factorization task
ideone.com/0PpOs8 <-- is what I came up with on short notice
 
@sehe oh, I wasn't following the discussion on factors, I thought rip Daddy didn't know how to check for palindromes
 
.... sigh
 
lol, it's late
 
There was no discussion on factors. It's called "requirements" :/
 
10:09 PM
@sehe ok, I read the problem. why is it necessary to factor, why not do brute force over all pairs of 3 digit numbers?
is there a time constraint (1 million multiplications seems trivial)?
 
@TemplateRex Euler is always time constrained, I think. I never did anything there
 
@sehe, your solution looks what I was thinking off, except for the check for being a palindrome
 
@StackedCrooked way to go with the obfuscated code contest :) I suppose it might break because (it) rit == (next(rit.base()-1)) or something silly like that
 
@sehe Yeah, it would break on even number of elements.
 
@TemplateRex you still need to be determining whether it is a product of 2 3-digit numbers...
@StackedCrooked reverse iterators are funky. they don't mix well with base iterators
 
10:14 PM
@sehe no, your double loop over pairs starting from 999 is what I would do, you are guaranteed to have a product
 
user1174868
Well I stil have no clue why my code won't work
 
@StackedCrooked can a comparison be made using std::distance ?
 
dunno
 
@StackedCrooked the conversion is explicit
@A.H. still have to convert
@ripDaddy69 you're checking whether j is the reverse of k. That has nothing to do with whether j * k is a palindrome o.O
 
user1174868
10:21 PM
isnt that what a palindrome is?
 
@sehe small optimization of your algo: change the double loop from [999, 99) x [999, 99) to sum=[1998,198) x left=[999, 99) and inside the loop do right=sum-left
 
@ripDaddy69 Hint: 47 * 74 = 3478 - wait, it's not a palindrome!
 
Xeo
@sehe That seems too little for 13 * 31
 
that will give you the answer quicker because you are zigzagging over the 2D grid of factors in diagonals of the highest possible sums
 
user1174868
@sehe j and k are not the multipliers but the first half of num and the second half
 
10:23 PM
@ripDaddy69 So where do you check for the constraints? (num must be the product of two 3-digit numbers...)
 
your current version e.g. check 999 x 100 before 998 x 998
 
user1174868
@sehe num = num - 999 and num is inititalized as 999*999
 
@TemplateRex possibly. like I said, it was quick & dirty.
I'm hacking a Java parser at the same time
@TemplateRex that's why I elected brute force :)
 
@sehe brute force would be when you loop in reverse order, sort of bubble-palindrome
 
@ripDaddy69 That's not what I asked. I didn't ask whether you could prove that one isolated number that's hardcoded in the code is a valid product, but the palindrome(s) that you find need to be
@TemplateRex I think I do. Oh you mean, worst-case bruteforce :/ Nah, I didn't need to be stupid
That's pessimization, something else than bf, IMO. My question is BF because it just keeps looking for a better candidate
 
user1174868
10:27 PM
I think I realized the problem with my code
 
You did? Whew
 
user1174868
I am only doing 999*998, 999*997....999*1
 
user1174868
I need to check 998*998
 
lol 1? Really. Is that even 3 digits?
 
user1174868
111
 
user1174868
10:29 PM
whatever
 
Come on. 100, maybe?!
 
user1174868
well 111111 is a palindrome
 
user1174868
but I guess it is possible for the palinedrome to be x * 100
 
Good guess
 
I'm home.
Yay.
 
10:39 PM
There isn't one, though
@Rapptz Congratulations
 
user1174868
man
 
user1174868
this problem is too hard
 
user1174868
no clue how to do it
 
Sleep on it.
 
user1174868
I would have to go from 999*999(-1)...999*100 and then something like 100*999(-1)
 
user1174868
10:42 PM
I just wasted like a whole afternoon on this, I better get back to my real homework lol
 
user1174868
Xeo is probalby right, I am not smart enough for programming. But it is what i like so I am going to stick with it
 
why don't you... go from (999*999),(999*998),...(998*999),(998,998),...(100*100)
Did you (want to) see my, simplistic approach?
 
This sounds like a PE question
 
user1174868
It is
 
user1174868
I am not smart enough for PE
 
10:44 PM
Me too man.
Which problem?
 
#4
 
user1174868
4
 
There's the mathematical way of doing (which is long) and the "fuck it I'm lazy" way of doing it. They're both fast enough to do it in the minute rule.
 
It's a minute rule ?! Lol. Then my simplistic version qualifies :/
 
There's actually no time limit, the minute rule just says you can do all the problems in <= 1 minute.
 
10:47 PM
g++ -std=c++0x -Wall -pedantic -g -O3 -isystem ~/custom/boost/ -march=native test.cpp -o test
sehe@desktop:/tmp$ time ./test
906609

real	0m0.006s
user	0m0.004s
sys	0m0.002s
 
lol
 
It's just C code, really (scroll up)
 
user1174868
ah man mine takes 6 seconds to return nothing
 
pop quiz, what does std::back_insert_operator::operator*() return?
 
Do you have a nested loop yet?
@MooingDuck a proxy (unspecified type)
 
user1174868
10:51 PM
I cant think out the nested loop for some reason
 
user1174868
I had one
 
no-op
 
user1174868
but it was wrong
 
@sehe that's what I thought too. Turns out that's wrong.
 
@MooingDuck a iterator_traits<It>::reference_type?
 
10:52 PM
It's just there so you can do *stuff++ to be consistent.
 
@sehe std::back_insert_iterator<Container>&
 
lol
 
user1174868
how would I do a loop that only lowers it one each time?
 
I can't imagine why the spec specifies that it returns itself. Why not allow for a proxy?
 
@ripDaddy69 for (unsigned x = XXX; x>0; --x)?
 
user1174868
10:53 PM
I don't know unsigned
 
WTF. Who cares? Take int (unsigned is short for unsigned int)
 
@ripDaddy69 same as int, but doesn't hold negatives.
 
Whoa, you must be really new.
 
user1174868
hey I got an answer
 
user1174868
I am new
 
10:53 PM
@Rapptz My guess is 11
 
user1174868
fml
 
user1174868
11?
 
@MooingDuck Same reason operator++ returns itself. What do you expect the useless proxy-object to do?
 
user1174868
Oh great I got the wrong answer
 
user1174868
but at least it was a palindrom
 
10:54 PM
It's there for consistency and to meet the requirements of Iterator/OutputIterator.
 
@ripDaddy69 keep looking for the largest match then :)
 
@Rapptz The same thing I guess. It just strikes me as an misuse of the type system
 
@Rapptz be assignable, just like (*ptr)
 
user1174868
what is --x?
 
user1174868
10:55 PM
compared to x--
 
@ripDaddy69 maybe you need a C++ book/class instead of a chatroom...
 
@ripDaddy69 pre-decrement
 
user1174868
@MooingDuck Why?
 
@sehe But the iterator itself is assignable, it's like a proxy itself really.
 
user1174868
I have ne ver seen that in a book
 
10:56 PM
@ripDaddy69 you seem to be missing a lot of the basics of C++. These are really basic.
 
user1174868
it is 90 degrees in here and I am sitting in a pool of sweat
 
@ripDaddy69 I don't believe you.
 
@Rapptz I know. The "But" in that sentence makes no sense
 
user1174868
I took scheme and java and this is a higher level CS class that uses C
 
@ripDaddy69 Have you looked in them?
 
10:57 PM
@Rapptz *myit = myit; //shouldn't compile IMO.
 
You are aware that ripDaddy69 is that YKQ56 from earlier today right?
 
@Borgleader Yes, we all know.
 
@Borgleader I had to refresh
 
From what I've seen, he seemed to have calmed down substantially.
 
@EtiennedeMartel ok just making sure
 
user1174868
10:58 PM
The problem with my loop is that I just do 999*998, 998*997 and I miss some numbers
 
@MooingDuck I'm going to go on a limb and say it doesn't?
Did you forget operator= for std::back_inserter_iterator calls push_back?
 
@Rapptz isn't it required to be copy assignable
no wait, output iterator
gah! You're right!
THAT IS SO WIERD
 
user1174868
how stupid would it be to do random numbers from 100-999 until I get an answer?
 
In computing, a Monte Carlo algorithm is a randomized algorithm whose running time is deterministic, but whose output may be incorrect with a certain (typically small) probability. The related class of Las Vegas algorithms is also randomized, but in a different way: they take an amount of time that varies randomly, but always produce the correct answer. A Monte Carlo algorithm can be converted into a Las Vegas algorithm whenever there exists a procedure to verify that the output produced by the algorithm is indeed correct. If so, then the resulting Las Vegas algorithm is merely to repeat...
 
@ripDaddy69 ...
 
user1174868
11:02 PM
I think we had to do that in a class one time
 
I bet.
 
welp
off to the doc's tomorrow
 
Ohai.
 
wish me luck
 
Woohoo! Going to Cali today!
or at least I can pretend...
 
11:05 PM
@DeadMG The best of that
 
and I'm also off to try and get some sleep
insofar as that is possible currently.
 
The fuck, the Doctor Who 50th anniversary episode airs on the same day as the MLP season 4 premiere.
It's like they're reading my mind.
 
what, air all the crap on one day?
 
@DeadMG good luck, seriously.
 
@DeadMG Everything is gonna be alright.
 
user1174868
11:14 PM
god it is hard to find a random function for C
 
@ripDaddy69 rand?
 
user1174868
just people arguing over more effective versions of incredibly complicated randomness
 
user1174868
@EtiennedeMartel I need a range of 100-999
 
@EtiennedeMartel Coming from mr happypants
 
@ripDaddy69 don't use rand for a Project Euler
 
user1174868
11:14 PM
I think it might be ok
 
user1174868
It is better than my solution now
 
user1174868
I am so close
 
user1174868
with random
 
kinda like seeing that the minister of information for Iraq is talking about all the battallions for Saddam Hussein and how they will drive the American invaders from the country with their glorious army
 
user1174868
j = getrand(100, 999);
k = getrand(100,999);
 
user1174868
11:15 PM
why is that wrong? It says getrand is undefined
 
@DeadMG I'm serious.
 
user1174868
Oh god I wasted a day on this
 
@ripDaddy69 I've never heard of "getrand" before.
 
user1174868
I know I am stupid
 
user1174868
11:21 PM
well my solution doesnt work anyways
 
@MooingDuck it's incorrect. Also: palendrome? :)
 
@sehe oh... it is? :(
 
user1174868
yeah 888888 is wrong
 
k. My is_palindrome probably has the error. I'll actually test it this time.
 
853358 (982 x 869)
855558 (957 x 894)
861168 (932 x 924)
886688 (968 x 916)
888888 (962 x 924)
906609 (993 x 913)
@MooingDuck Or write it lots simpler
 
11:23 PM
@MooingDuck lol....
 
@sehe I couldn't think of a simpler way
 
user1174868
well I think I am done with project euler forever, I knwo I am not smart enough for it now at least
 
user1174868
I should just switch to a business degree
 
@ripDaddy69 You just confirmed you don't have patience. READ THAT BOOK
@ripDaddy69 Or that.
 
user1174868
11:25 PM
what book?
 
ANY BOOK
 
user1174868
I jsut spent 8 hours on this
 
user1174868
how is that not patience?
 
@ripDaddy69 you have no idea
 
user1174868
this was a simple problem that takes most people like 30 minutes
 
user1174868
11:27 PM
I spent all day oni t and now I am way behind on homewokr
 
I think you spent 8 hours raving and moaning. Have you ever sat down with pencil and paper and walked through the steps manually? Have you added debug tracing to your program to see whether it did as you expected? Guess: no. Did you jump all around, even resorting to 'no-fliers' as random selection? Yeah, that's gonna work.
 
user1174868
yes
 
user1174868
that is what I did
 
@sehe my try (find1) vs yours (find2) coliru.stacked-crooked.com/a/d573a3233d981189
 
@ripDaddy69 Such careful communication. It's completely ambiguous what you're saying there
 
user1174868
11:29 PM
I wrote it all down and walked through it many times
 
Then, excel it is :(
 
user1174868
there is just no way to prove that I am trying at this
 
user1174868
everyone thinks i am too stupid and too lazy
 
I don't see anyone stating that. I'm observing a FACT: you're spending an awful lot of time moaning and complaining that you can't figure this out, and you seem angry because you're entitled to get it, somehow.
 
user1174868
where was I whining?
 
11:32 PM
Oh god. Buy a mirror, one day. I'm out. And plonk
 
user1174868
I wasnt whining in here until people started whining that I was whining
4
 
LOLOLOLOLOL. Epic.
 
@sehe the 1 minute constraint for Euler is so not binding, you can get your solution on Coliru even for 4-digit factor palindromes (10 second limit)
 
@sehe oh.... I'd assumed that I could find the biggest palindrome fastest by maximizing min(x,y). and so I break early...
 
Maybe ripDaddy wants to trade places: I've been battling this all night paste.ubuntu.com/6090292 and that's only the current compiler error novel. Patience is will power.
@MooingDuck I had that too. First. Lol
 
11:38 PM
@sehe maybe in another reincarnation ;-)
 
It appears that we had yet another Internet Argumentâ„¢ here in Lounge<C++> Lounge<California>.
 
user1174868
@MooingDuck I will trade places, but can we trade income too?
 
alright kids, goodnight for me
 
@StackedCrooked Neat :)
 
@StackedCrooked woot
 
11:43 PM
@sehe That deserves a star.
> And please, for the love of all that is nice and fluffy, don't act like we owe you something. You'll get flamed to death.
This is so appropriate somehow.
 
user1174868
I never acted like that?
 
user1174868
I made a pretty good program, it crashes in 1.4 seconds
 
user1174868
kind of cool
 
Damn it, why isn't this loading?
 
user1174868
oh I just realized c has that memory thing, do I have to release memory in a loop?
 
11:47 PM
2 mins ago, by rip Daddy 69
I made a pretty good program, it crashes in 1.4 seconds
 
I'll never understand why Microsoft made MAX_PATH 260
 
Either I don't understand the context of this conversation, or that sentence is a contradiction in terms.
 
user1174868
I think it is impressive that it can crash so quickly
 
1.4 seconds isn't fast.
 
user1174868
that is like backing up out of your driveway and exploding before you hit the street
 
11:49 PM
@ripDaddy69 I can write a program that crashes even sooner than 1.4 seconds. That's not particularly impressive.
 
user1174868
well it is to me
 
@Rapptz I think it's 256 chars + drive letter + colon + slash + NULL terminator.
 
@Insilico But why so small?
 
user1174868
Where is the documentation on Process terminated with status -1073741510
 
@Rapptz I don't know, TBH.
 
11:50 PM
On Linux it varies from 1024 to like 4096
 
@Rapptz Actually the maximum path length on Windows is like 32768 if you use Unicode filepaths.
 
Yeah I know that too
 
user1174868
I guess I need to learn to debug
 
You didn't even know what --i did until 15 minutes ago.
 
@ripDaddy69 That in hexadecimal is 0xC000013A (assuming 32-bits). Try searching for that.
 
user1174868
11:53 PM
Wow
 
user1174868
my program shouldb't be that complex
 
user1174868
bascially it is something with my loops but I see no fault
 
@ripDaddy69 Did you use a debugger yet?
 
user1174868
no
 
user1174868
I don't understand it
 
11:57 PM
@ripDaddy69 Don't understand what? Your code? That's a very good reason to fire up a debugger.
 
user1174868
the debugger
 
@MooingDuck PE?
 
@Code-Guru so someone said
 
@ripDaddy69 What debugger do you have?
 
11:58 PM
@Code-Guru ezpz PE.
 
welp, forget sleep
 
I'm about to play Amnesia: A Machine For Pigs. If you don't hear from me in a few days. It was nice knowing all of you ;)
 
user1174868
@Code-Guru Whatever codeblocks uses
 
@Rapptz yah...I'm just behind and haven't spent a lot of time catching up.
 
user1174868
my code is like 10 lines, no way it is causing a problem like this
 
user1174868
11:59 PM
I must have typed something wrong
 
@ripDaddy69 Click on the Help button. It should have topics that explain exactly how to use the debugger.
 
@MooingDuck What's with the assembly?
 
@EtiennedeMartel Although I phrased it as a joke, I'm quite serious about the fundamentals of what I said.
 
@Rapptz clock doesn't have high enough resolution, so I'm grabbing the CPU count, which may or may return useful numbers
 
You know there's std::chrono right? :s
 

« first day (1060 days earlier)      last day (3886 days later) »