Search found 8 matches

by Joel J. Hernandez
Thu May 18, 2006 10:42 pm
Forum: Volume 1 (100-199)
Topic: 119 - Greedy Gift Givers
Replies: 145
Views: 47352

PE

Ok I got it but I get PE...
Anything wrong on my output??
Here is output code:

for(i=0; i<n; i++)
{
sum=0;
for(j=0; j<n; j++)
{
sum+=matrix[j][i];
if(matrix[j][i]!=0)
{
zerocounter++;
}
}
cout<<p[i].name<<" ";
if(zerocounter==0)
{
cout<<0;
}
else
{
cout<<sum-capital[i];
}
cout ...
by Joel J. Hernandez
Thu May 18, 2006 10:16 pm
Forum: Volume 1 (100-199)
Topic: 119 - Greedy Gift Givers
Replies: 145
Views: 47352

???

Ok I got WA...
What the h.....???

Any body??
by Joel J. Hernandez
Thu May 18, 2006 10:13 pm
Forum: Volume 1 (100-199)
Topic: 119 - Greedy Gift Givers
Replies: 145
Views: 47352

119 special case

How about a special case:
There is a post on this forum discussing the following input/output:
Input:
2
a 10 0
b 10 0

I'm about to submit my code, and according to it, it will print a -10 and b-9.
Why?
Simple:
a spends 10 and b spends 9. They both received 0, so they lost 10 and 9 recpectively. It ...
by Joel J. Hernandez
Thu May 18, 2006 1:55 am
Forum: Volume 1 (100-199)
Topic: 106 - Fermat vs. Pythagoras
Replies: 138
Views: 30297

106 FINALLY!!!!!!!!!!!!!

Ok thanks anyways guys.
I finally got ACC, I used dynamic memory and also my method for finding all triples is quite fast, like O(nlogn).

I submitted this program more than 30 times and always got WA or RE and it was because of the arrays thing, so be carefull.

Thank you.

I'm so happy!!!!!
by Joel J. Hernandez
Wed May 17, 2006 11:58 pm
Forum: Volume 1 (100-199)
Topic: 106 - Fermat vs. Pythagoras
Replies: 138
Views: 30297

106 WA but it works for all cases....???WHY WA

Here is my code, if you test in your computer you will see that it gives the correct answer for every input, but the judge keeps replying WA....

What is wrong?????


#include <iostream>
#include <cmath>
using namespace std;
struct triple
{
int x, y, z;
};
void q_sort(triple numbers[], int ...
by Joel J. Hernandez
Wed May 17, 2006 6:11 am
Forum: Volume 1 (100-199)
Topic: 106 - Fermat vs. Pythagoras
Replies: 138
Views: 30297

106 Fermat Vs Pythagoras 0.1sec!!

Hi there.
I'm very sad.
My program runs in 10.1 sec which is only 0.1 sec more than the limit for this proglem....

Here is my code, which I'll romove soon.
Hope somebody gives me a hint...

#include "stdafx.h"
#include <iostream>
#include <cmath>
using namespace std;
struct triple
{
double x, y, z ...
by Joel J. Hernandez
Tue May 16, 2006 10:03 pm
Forum: Volume 1 (100-199)
Topic: 106 - Fermat vs. Pythagoras
Replies: 138
Views: 30297

Oooppppsssssssssssss.............
You are right.
Thanks so much. I guess then my method for finding all triples(not just primitive triples is wrong).

This is what I do for that:

loop a) starts at 1 and keeps going as long as i^2 + (i+1)^2 <=n

nested loop b) starts at i+1 and keeps going as long ...
by Joel J. Hernandez
Tue May 16, 2006 9:43 pm
Forum: Volume 1 (100-199)
Topic: 106 - Fermat vs. Pythagoras
Replies: 138
Views: 30297

106 Fermat Vs Pitagoras wrong sample.

I need some serious help. Unless I'm blind I think sample is wrong.
Here is why:

Input: 25

There are only 4 primitive triples: (3, 4, 5), (15, 8, 17), (5, 12, 13), and
(7, 24, 25).
This is ok, so answer to the first question is fine.

But second part I think it's wrong and here is why:
Besides the ...

Go to advanced search