Search found 112 matches

by epsilon0
Thu Oct 23, 2003 8:00 pm
Forum: Volume 1 (100-199)
Topic: 104 - Arbitrage
Replies: 223
Views: 13508

this problem seems interesting, i will try to solve it. i have 2 things to tell you: 1) the error you get means your program is incorrect, which has nothing to do with what the program actually does, but how it is written. 2) your algorithm seems incorrect too. let me explain: imagine there are 20 c...
by epsilon0
Fri Oct 10, 2003 5:09 pm
Forum: Volume 1 (100-199)
Topic: 107 - The Cat in the Hat
Replies: 278
Views: 20009

this problem is stupid. input (1,#) (where # different from 1) makes no sense. if the top level cat has height 1, then there can be no other cat, and the top level cat is a worker cat (the only one). thus the only acceptable (1,#) input is (1,1) and the answer is obviously 0 1. input (#, 0) makes no...
by epsilon0
Sat Sep 27, 2003 2:58 pm
Forum: Volume 1 (100-199)
Topic: 113 - Power of Cryptography
Replies: 162
Views: 15776

double can handle input more than that, 10^(+/-300) i doubt it. double is something like 8 bytes on most hardware. 2 ^ 64 is roughly 10 ^ 20 how can this problem be solved with double? i used a special structure to describe very large numbers, then i redefined operations like ADD MUL etc... my prog...
by epsilon0
Sat Sep 27, 2003 12:51 pm
Forum: Volume 1 (100-199)
Topic: 138 - Street Numbers
Replies: 93
Views: 6970

here is my C code for this problem. as you can see, it's quite short. you will notice that you can improve it. obviously, the test if (!((int)xi % 2)) is useless if you replace j++ with j += 2 in the loop. the square of an odd number cannot be even!!! also, my mate Olivier Bery has a solution for th...
by epsilon0
Tue Sep 23, 2003 7:35 pm
Forum: Volume 1 (100-199)
Topic: 138 - Street Numbers
Replies: 93
Views: 6970

hints

here are a few hints: 1] the sum of all integers from 1 to n is n * (n+1) / 2 2] n and n + 1 don't have any common divisor (other than 1). 3] look at the first two couples: 6 8 35 49 6 = 2 * 3 and 8 = 2 * 2^2, 8+1 = 9 = 3^2 in other words 8 * 9 / 2 = 6^2 35 = 5 * 7 and 49 = 7^2, 49+1 = 50 = 2 * 5^2 ...
by epsilon0
Thu Sep 11, 2003 4:22 pm
Forum: Volume 2 (200-299)
Topic: 294 - Divisors
Replies: 91
Views: 23519

there is a smarter solution.

you don't need to try every divisor for a number n.

if you know its prime factors, it's easy then to compute the number of divisors.

so all you really need is a list of prime numbers (which you compute only once), then you can get prime factors of any number quickly.
by epsilon0
Tue Sep 09, 2003 10:57 pm
Forum: Volume 1 (100-199)
Topic: 129 - Krypton Factor
Replies: 25
Views: 2472

xbeanx wrote: "For this problem, I know how to build an infinitely long square-free string, but I don't know how to output it correctly." really? i'm very much curious about it. would you care to explain me how you can produce such an infinite sequence? also, i solved this problem with a recursive f...
by epsilon0
Thu Jun 12, 2003 2:18 pm
Forum: General
Topic: SECURITY FLAW IN ONLINE JUDGE
Replies: 34
Views: 8482

of course not. the input has to be the same, otherwise each problem would need a specific judge program. actually there is one judge program for all problems. it just compares your output against a reference output file. the input file, thus, has to be constant. there are programs with a special jud...
by epsilon0
Wed Jun 11, 2003 12:06 pm
Forum: Volume 1 (100-199)
Topic: 102 - Ecological Bin Packing
Replies: 485
Views: 35484

short analysis of your problem: 1] they wrote: "The total number of bottles will never exceed 2^31." 2] you wrote: "long min=65535,t;" 3] conclusion: cannot determine wether you can't read, can't do math, or both. pardon my roughness, but this kind of error makes me mad. your code is nearly perfect,...
by epsilon0
Tue Jun 03, 2003 6:05 pm
Forum: Volume 2 (200-299)
Topic: 240 - Variable Radix Huffman Encoding
Replies: 6
Views: 5677

hello, i just solved this problem. (i got PE). my implementation has the following structures: an encoding tree that is stored as an array of fathers. each node in the tree has additional fields that include: letter, weigth, position relative to siblings. these informations will allow building the t...
by epsilon0
Sat May 31, 2003 2:48 pm
Forum: Volume 2 (200-299)
Topic: 283 - Compress
Replies: 16
Views: 6149

this problem is STUPID 1] the text is very unclear about the encoding scheme. so i assume it is an huffman encoding (= optimal bitlength) with an extra condition, that all codes must have 8 bit maximum. so i assumed it was a "modified huffman". 2] i'm sure the sample output is wrong if my assumption...
by epsilon0
Mon May 26, 2003 3:48 pm
Forum: Volume 2 (200-299)
Topic: 227 - Puzzle
Replies: 56
Views: 9155

hello Olivier, remember your old mate epsilon zero? :P i just solved this 227 puzzle. i had no problem with input, i used fgets to fetch each line. since i had AC, i can tell you that you can assume the following: the "command lines" have no space in them, ie: AAAA BB0 <-- you will never have someth...
by epsilon0
Sat May 24, 2003 4:02 pm
Forum: Volume 2 (200-299)
Topic: 267 - Of(f) Course!
Replies: 16
Views: 2361

obviously wind direction 290 means wind *comes from* 290. this is why ground speed is less than true air speed. (wind comes from the front, not back) so one would expect aircraft heading to always be between desired course and wind speed. (unless the difference is greater than 180 then it's not) bes...
by epsilon0
Sat May 24, 2003 3:21 pm
Forum: Volume 2 (200-299)
Topic: 258 - Mirror Maze
Replies: 18
Views: 3085

read more carefully

it is STATED in the problem description that all mazes admit at least one solution. you could also notice that this problem has a special judge program. this is typical of problems that have several solutions. you can enter any solution, and the judge will check it. it's different from other problem...
by epsilon0
Sat May 24, 2003 3:10 pm
Forum: Volume 2 (200-299)
Topic: 258 - Mirror Maze
Replies: 18
Views: 3085

wrong

Dear broderic, you are wrong about something (although it won't help you solve the problem): you assume it is possible to encounter a mirror with its lock set to 2. well it isn't. it is impossible to hit a mirror more than twice (once on each side). think about it, and you'll see. it can be proved v...

Go to advanced search