Search found 22 matches

by d91-lek
Fri May 12, 2006 7:54 pm
Forum: Volume 106 (10600-10699)
Topic: 10617 - Again Palindrome
Replies: 12
Views: 5819

Good point. Usual integer is not big enough. I didn't think of this at first and then worried I had to use my bignum routines. It was close but C can manage. Biggest test case 1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA Answer 1152921504606846975 8 bytes are needed to store 2^60 p...
by d91-lek
Fri May 12, 2006 5:44 pm
Forum: Volume 106 (10600-10699)
Topic: 10617 - Again Palindrome
Replies: 12
Views: 5819

f(BAOBAB) = 1 + f(AOBA) + f(BAOBA) + f(AOBAB) - f(AOBA) The first and last character are either the same or not. Above they are the same and form 1 + f(AOBA) palindromes plus the ones where only one or the other of them is member minus the interval counted twice. Memoization, keeping a lookup table ...
by d91-lek
Wed Nov 23, 2005 4:03 pm
Forum: Volume 3 (300-399)
Topic: 361 - Cops and Robbers
Replies: 50
Views: 14219

''Can you post some I/O please.... '' I have lost touch with this problem so I don't remember what situations are crucial. But I have my program to test-run input if you are unsure what the correct answer should be. (If I can get it to compile again, seems to be problems with using std with the new ...
by d91-lek
Sat Nov 19, 2005 11:21 pm
Forum: Volume 3 (300-399)
Topic: 361 - Cops and Robbers
Replies: 50
Views: 14219

>> Why the second case is 'safe'??Shouldn't it be 'robbed'??.... Yes, it should be 'robbed'. Quite right of you. It is very shameful of me to put out incorrect test data. Feel free to repost the entire set with correct answer if you like. BTW, I got quite a lot of presents. Especially a warm, red sw...
by d91-lek
Fri Nov 18, 2005 6:13 am
Forum: Off topic (General chit-chat)
Topic: How many language do you know?
Replies: 32
Views: 16129

Oh my dear, I used to make lists of languages for CV:s and personal gratification but my expanding ego - not interest - led me to studying computer language theory and higher order logic and I just lost all pride and interest in my list. What does it really mean to KNOW a language? What IS a languag...
by d91-lek
Fri Nov 18, 2005 4:30 am
Forum: Volume 3 (300-399)
Topic: 361 - Cops and Robbers
Replies: 50
Views: 14219

Sorry about the delay, but we seem to have so fundamentally different opinions on triangles I had to go read the problem specificaton and a math book or two. I am very weak at debating so I'll try Socrates' method of reasoning on your line until we run into contradictions, or in this case, ugliness....
by d91-lek
Wed Nov 16, 2005 5:45 pm
Forum: Volume 3 (300-399)
Topic: 361 - Cops and Robbers
Replies: 50
Views: 14219

Jan, very clever of you to think of the triangle inequality, the only criteria for a triangle. However, you have it wrong! The sum of any two sides must be greater than or equal to the third. We simply must allow for triangles with no area. (0,0) - (0,0) - (0,0) is indeed a triangle. The only point ...
by d91-lek
Mon May 09, 2005 7:56 pm
Forum: Algorithms
Topic: BigInteger
Replies: 10
Views: 3204

Everytime I'm doing bit manipulation in C I badly miss access to the carry and/or overflow flags. Last time I needed carry I wrote something like this unsigned long long a, b, sum; sum = a + b; carry = sum < a || sum < b; ... Hackers delight, Henry S. Warren Jr., ISBN: 0201914654, gives everyone wh...
by d91-lek
Mon Dec 13, 2004 9:14 pm
Forum: Volume 1 (100-199)
Topic: 193 - Graph Coloring
Replies: 93
Views: 20782

The problem is actually Maximal Independent Set. But of course, that's NP-complete as well. Cormen, Leiserson, Rivest say you should not confuse Maximal Set with Maximum Set. Maximal Set being just an independent set which can't grow more. I solved 193 - Maximum Independent Set - by taking the bigg...
by d91-lek
Fri Dec 10, 2004 10:41 pm
Forum: Algorithms
Topic: BigInteger
Replies: 10
Views: 3204

Everytime I'm doing bit manipulation in C I badly miss access to the carry and/or overflow flags. Last time I needed carry I wrote something like this unsigned long long a, b, sum; sum = a + b; carry = sum < a || sum < b; The time before, I wrote something completely different but exactly as roundab...
by d91-lek
Fri Dec 10, 2004 5:37 pm
Forum: Volume 2 (200-299)
Topic: 254 - Towers of Hanoi
Replies: 39
Views: 16420

Got AC when I reversed the peg order. Example input is
not decisive in this matter. 100 1 should of course give
99 1 0 and not 99 0 1.

Correct output for the input above is:

Code: Select all

1 1 1
62 1 1
4 2 2
0 0 100
99 1 0
2 18 16
7 6 10
27 31 22
11 31 25
43 26 30
26 26 36
by d91-lek
Fri Dec 10, 2004 1:50 am
Forum: Volume 2 (200-299)
Topic: 254 - Towers of Hanoi
Replies: 39
Views: 16420

Test data needed

- deleted -
by d91-lek
Fri Dec 10, 2004 1:49 am
Forum: Volume 2 (200-299)
Topic: 254 - Towers of Hanoi
Replies: 39
Views: 16420

Test data needed

Could some merciful soul please post the result of this indata: 3 5 64 2 8 45 100 1267650600228229401496703205375 100 1 36 23478162346434234 23 231234 80 398573924759238475987234 67 2349302402348238482342348 99 3895732987529387459237955432 88 747328293948729334241100234 0 0 I get 1 1 1 62 1 1 4 2 2 ...
by d91-lek
Thu Dec 02, 2004 3:22 am
Forum: Volume 2 (200-299)
Topic: 271 - Simply Syntax
Replies: 46
Views: 12249



EppIqq

You should output "Yes".
Oh, but that is not a valid sentence. Two, yes, but we should
only output YES for exactly one valid sentence per line. Please
refer to the final example: Cqpq.
by d91-lek
Tue Nov 16, 2004 6:41 am
Forum: Volume 3 (300-399)
Topic: 361 - Cops and Robbers
Replies: 50
Views: 14219

I had big trouble determining the case of being on the polygon. When the hull is flat and every turn is either 0 or 180 degrees, the cross product isn't enough to reject or embrace a point on the same line as the edges of the hull. See final set below. I used to get safe. 0 2 1 0 0 0 0 0 0 0 3 1 0 0...

Go to advanced search