Search found 90 matches

by Minilek
Mon Aug 02, 2004 2:48 pm
Forum: Volume 1 (100-199)
Topic: 106 - Fermat vs. Pythagoras
Replies: 138
Views: 12507

Ryan Pai wrote: Ok, so why does this generate all triples? Well, lets assume that x,y,z is a triple which is relatively prime, so not both of x,y can be even... Doesn't this only prove that the method generates all relatively prime triples? How do you deal with counting the number of numbers <=N tha...
by Minilek
Mon Aug 02, 2004 2:35 pm
Forum: Volume 1 (100-199)
Topic: 106 - Fermat vs. Pythagoras
Replies: 138
Views: 12507

Chocobo said: (the second number)=N-(the number of all triples) This is not true. Let's take a really easy example, N=5. The number of all triples with x<y<z and x^2 + y^2 = z^2 is 1 (the only one is 3,4,5). Your method would say then that there are N - 1 = 5 - 1 = 4 numbers not appearing in triples...
by Minilek
Mon Aug 02, 2004 11:13 am
Forum: Volume 1 (100-199)
Topic: 147 - Dollars
Replies: 233
Views: 21860

I think there is something I don't understand about printf formatting. The following 147 solution of mine got AC but with a presentation error. May someone please guide me as to how I'm supposed to properly format the answer? I've tried googling the subject, but haven't managed to find anything usef...
by Minilek
Mon Aug 02, 2004 8:34 am
Forum: Volume 4 (400-499)
Topic: 443 - Humble Numbers
Replies: 82
Views: 7339

ya, thanks for the reply. just saw that a few minutes ago, and fixed it (also gotta change for numbers ending in 12 and 13 too to not be "nd" and "rd"). *sigh*...*shoots himself in the foot*

This code got AC:

[c]
AC
[/c]
by Minilek
Mon Aug 02, 2004 7:06 am
Forum: Volume 4 (400-499)
Topic: 443 - Humble Numbers
Replies: 82
Views: 7339

I have also done this problem but get WA. I tried my program on all their example inputs and it worked perfectly (their example inputs include 5842, 1000, and some other smaller numbers as well). Is there something I'm not seeing here? [c] gone [/c] I thought maybe it was the fact that I was using a...
by Minilek
Mon Aug 02, 2004 4:24 am
Forum: Algorithms
Topic: generate palindromes numbers...(Usaco problem)
Replies: 3
Views: 1840

Re:

I haven't gotten to this problem yet in USACO, but after reading your message I think I see how to do it... [Edit] Doh I'm dumb..yes I have done this problem. : ) I completely forgot about it, too long ago heh. For some reason when I did the problem I didn't realize the even-number of digits thing t...
by Minilek
Fri Jul 30, 2004 6:21 pm
Forum: Algorithms
Topic: BigInteger
Replies: 10
Views: 3253

That's what I've been doing so far actually (representing bignum's as just arrays of digits), but it seems so inefficient. For example, one could optimize it by making each element in the array as big as an int allows vs. just a single digit to get as much work done per instruction as possible (or a...
by Minilek
Thu Jul 29, 2004 9:02 am
Forum: Volume 4 (400-499)
Topic: 409 - Excuses, Excuses!
Replies: 63
Views: 9107

weird

hm..not quite sure what happened there

but anyway, you do it : )
by Minilek
Thu Jul 29, 2004 9:01 am
Forum: Volume 4 (400-499)
Topic: 409 - Excuses, Excuses!
Replies: 63
Views: 9107

code tags

you should really use the code tags [c]#include<stdio.h> #include<string.h> #include<ctype.h> char word[1000],key[50][100],re[50][100],ans[50][100],*p; void clear() { int i,j; for(i=0;i<=50;i++) for(j=0;j<=100;j++) ans [j]=re [j]=key [j]='\0'; } int restore(int j) { int v; for(v=0;re[j][v]!='\0';v++...
by Minilek
Thu Jul 29, 2004 3:09 am
Forum: Algorithms
Topic: Help With USACO Problem
Replies: 13
Views: 3210

Easier algorithm

yaro's algorithm works in n^2lgn, but there is an algorithm that is easier to code which works in n^3 (which is still good enough for the test cases). basically note that everytime you put a new rectangle on top, it intersects each rectangle to make at most 4 new rectangles. so just loop through add...
by Minilek
Thu Jul 29, 2004 3:06 am
Forum: Algorithms
Topic: BigInteger
Replies: 10
Views: 3253

BigInteger

Hi. I wanted to ask, what do most people do to handle numbers that are more than 64 bits? java.math is disabled so we don't have access to BigInteger, and I can't seem to find anything in the gnu library for bigint. Do people just make their own? Or is there code out there that we can just use? (I'v...
by Minilek
Wed Jul 28, 2004 7:49 am
Forum: Volume 4 (400-499)
Topic: 495 - Fibonacci Freeze
Replies: 222
Views: 31195

BigInt

When you say you used BigInt for java, you mean java.math.BigInteger? I thought we can't use the java.math library for ACM?
by Minilek
Tue Jul 27, 2004 12:19 pm
Forum: Volume 1 (100-199)
Topic: 101 - The Blocks Problem
Replies: 635
Views: 40431

Thanks

Claudio wrote:
Try to move all declarations before any line of code...
Thanks, I did that and now the solution was accepted. Is this very standard? This is the first time I've come across a compiler where you had to make all declarations before any other code.
by Minilek
Tue Jul 27, 2004 9:57 am
Forum: Volume 1 (100-199)
Topic: 101 - The Blocks Problem
Replies: 635
Views: 40431

Problem #

Forgot to mention, this is problem # 101.
by Minilek
Tue Jul 27, 2004 9:39 am
Forum: Volume 1 (100-199)
Topic: 101 - The Blocks Problem
Replies: 635
Views: 40431

Compiler Error? (but works on my machine)

I'm not sure exactly why I'm getting a compiler error. The judge seems to have a problem with my declaration of command and prep, but the program compiles and works fine on my computer (I'm also using gcc). I've also tried submit-o-matic just in case my email client was adding in extra weird charact...

Go to advanced search