Hello everybody!
I trying to solve this problem using brute force, don't know if there is some formula to calculate it... Is there some formula?!
How could I optimize my algorithm?!
Thanks!
Search found 14 matches
- Fri Sep 01, 2006 7:58 pm
- Forum: Volume 101 (10100-10199)
- Topic: 10161 - Ant on a Chessboard
- Replies: 10
- Views: 6742
- Fri Aug 18, 2006 1:02 pm
- Forum: Volume 4 (400-499)
- Topic: 413 - Up and Down Sequences
- Replies: 22
- Views: 9767
413 - up and down sequences
Hello everybody!
I tried lots of stuff but I think I didn't understand the problem at all... I think I am doing the wrong thing when the sequences has neutral values (no up nor down)...
It works fine for lots of inputs, but I tried with this
1 2 3 4 5 6 7 8 0
8 7 6 5 4 3 2 1 0
1 1 1 1 1 0
9 9 ...
I tried lots of stuff but I think I didn't understand the problem at all... I think I am doing the wrong thing when the sequences has neutral values (no up nor down)...
It works fine for lots of inputs, but I tried with this
1 2 3 4 5 6 7 8 0
8 7 6 5 4 3 2 1 0
1 1 1 1 1 0
9 9 ...
- Tue Jan 03, 2006 6:42 pm
- Forum: Volume 1 (100-199)
- Topic: 190 - Circle Through Three Points
- Replies: 126
- Views: 37352
division by zero
Thanks!
Any clue on how avoiding division by zero in this case?
I tried to add very small vlaues in the denominators of the fractions (like 0.000000001 or something) but it changes the output...
Any clue on how avoiding division by zero in this case?
I tried to add very small vlaues in the denominators of the fractions (like 0.000000001 or something) but it changes the output...
- Tue Jan 03, 2006 6:37 pm
- Forum: Volume 1 (100-199)
- Topic: 190 - Circle Through Three Points
- Replies: 126
- Views: 37352
Still Wa :(
Thanks you for uor reply
I fixed my code to generate answer like ur code do, but still getting WA...
Here's my new code
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;
class point
{
public:
double x, y;
};
int main()
{
point p1, p2, p3;
double ma, mb, h, k ...
I fixed my code to generate answer like ur code do, but still getting WA...
Here's my new code
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;
class point
{
public:
double x, y;
};
int main()
{
point p1, p2, p3;
double ma, mb, h, k ...
- Tue Jan 03, 2006 2:10 pm
- Forum: Volume 1 (100-199)
- Topic: 190 - Circle Through Three Points
- Replies: 126
- Views: 37352
190-Circle Through Three points -WA-Already read past posts!
Hi everybody!
I'm getting WA in problem 190 - Circle through three points over and over again...
Can someone please check my code, maybe u can find where it's wrong....
I need some critical test cases or something...
For the following input:
7.0 -5.0 -1.0 1.0 0.0 -6.0
1.0 7.0 8.0 6.0 7.0 -2 ...
I'm getting WA in problem 190 - Circle through three points over and over again...
Can someone please check my code, maybe u can find where it's wrong....
I need some critical test cases or something...
For the following input:
7.0 -5.0 -1.0 1.0 0.0 -6.0
1.0 7.0 8.0 6.0 7.0 -2 ...
- Tue Dec 27, 2005 6:45 pm
- Forum: Volume 107 (10700-10799)
- Topic: 10703 - Free spots
- Replies: 26
- Views: 12214
Here is what I did...
I did the following algorthm to get AC:
1) Initialized an array of bool board[500][500], all true;
2)Read the sub_boards. This is an important point, because X1,Y1,X2,Y2 are NOT NECESSARILY given in that order. So you need to swap X1 and X2 if X1 > X2, and swap Y1 and Y2 if Y1 if Y1 > Y2.
3) With 2 ...
1) Initialized an array of bool board[500][500], all true;
2)Read the sub_boards. This is an important point, because X1,Y1,X2,Y2 are NOT NECESSARILY given in that order. So you need to swap X1 and X2 if X1 > X2, and swap Y1 and Y2 if Y1 if Y1 > Y2.
3) With 2 ...
- Tue Dec 27, 2005 2:18 pm
- Forum: Volume 108 (10800-10899)
- Topic: 10813 - Traditional BINGO
- Replies: 28
- Views: 14244
Thanks tan_Yui!
Your sample input/output helped me a lot!
Thank you!
Thank you!
- Tue Dec 27, 2005 4:56 am
- Forum: Volume 4 (400-499)
- Topic: 494 - Kindergarten Counting Game
- Replies: 119
- Views: 37258
How could I be so STUPID?!
You we're right....
I was too stupid, im sorry for bothering u all!
Ang I Got AC! Thanks!
I was too stupid, im sorry for bothering u all!
Ang I Got AC! Thanks!
- Tue Dec 27, 2005 1:52 am
- Forum: Volume 4 (400-499)
- Topic: 494 - Kindergarten Counting Game
- Replies: 119
- Views: 37258
Still CE... :(
Hi!
I posted the following code, but I'm still getting CE...
I changed the lines you told me but.. it's not getting accepted... what else an be wrong?
Thank you
#include <string>
#include <iostream>
#include <ctype.h>
//#include <iomanip>
using namespace std;
int main()
{
string linha, cur ...
I posted the following code, but I'm still getting CE...
I changed the lines you told me but.. it's not getting accepted... what else an be wrong?
Thank you
#include <string>
#include <iostream>
#include <ctype.h>
//#include <iomanip>
using namespace std;
int main()
{
string linha, cur ...
- Mon Dec 26, 2005 3:00 am
- Forum: Volume 4 (400-499)
- Topic: 494 - Kindergarten Counting Game
- Replies: 119
- Views: 37258
Still not working...
I changed the line
cur_word.clear();
by
cur_word = ''";
It compiled and worked fine in my pc under g++ and cygwin, but i'm still getting CE... any suggestions?!
Thanks!
cur_word.clear();
by
cur_word = ''";
It compiled and worked fine in my pc under g++ and cygwin, but i'm still getting CE... any suggestions?!
Thanks!
- Mon Dec 26, 2005 12:34 am
- Forum: Volume 4 (400-499)
- Topic: 494 - Kindergarten Counting Game
- Replies: 119
- Views: 37258
494 - Compile Error
Hi everybody!
I don't know why it's getting CE, it compiles normally with g++ at cygwin...
Please take a look!
Thanks, my code follows :)
#include <string>
#include <iostream>
#include <cctype>
//#include <iomanip>
using namespace std;
int main()
{
string linha, cur_word;
int count, char ...
I don't know why it's getting CE, it compiles normally with g++ at cygwin...
Please take a look!
Thanks, my code follows :)
#include <string>
#include <iostream>
#include <cctype>
//#include <iomanip>
using namespace std;
int main()
{
string linha, cur_word;
int count, char ...
- Thu Dec 08, 2005 9:45 pm
- Forum: Volume 101 (10100-10199)
- Topic: 10173 - Smallest Bounding Rectangle
- Replies: 18
- Views: 7293
10173 - Smallest Bounding Rectangle
Well, my program works fine for the tests given in the program, but i'm getting WA...
The idea I used is simple: sort the numbers using the x-coordinate as the sorting parameter... The difference between the last point x coordinate and the first point x coordinate should be the base of the rectangle ...
The idea I used is simple: sort the numbers using the x-coordinate as the sorting parameter... The difference between the last point x coordinate and the first point x coordinate should be the base of the rectangle ...
- Mon Dec 05, 2005 8:00 pm
- Forum: Volume 3 (300-399)
- Topic: 369 - Combinations
- Replies: 101
- Views: 33328
Almost there... :(
This thing is driving me mad... This should be a simple task, but I don't know how....
Well, the problem is: How to choose the right numbers to use (and how to keep track of them) to simplify the fraction?
My code works for the test cases given in the problem, but i'm getting WA anyway. I think the ...
Well, the problem is: How to choose the right numbers to use (and how to keep track of them) to simplify the fraction?
My code works for the test cases given in the problem, but i'm getting WA anyway. I think the ...
- Thu Dec 01, 2005 8:42 pm
- Forum: Volume 3 (300-399)
- Topic: 369 - Combinations
- Replies: 101
- Views: 33328
369 (combinations) - how to?!
Hi everyone!
I'm trying to solve the problem #369, but I don't know how to do it... I have a library with functions to manipulate big integers and I was trying to do the factorials in the ordinary way, i.e, multiplying... I don't know if i'm having some overflow problem or not, but my problem is ...
I'm trying to solve the problem #369, but I don't know how to do it... I have a library with functions to manipulate big integers and I was trying to do the factorials in the ordinary way, i.e, multiplying... I don't know if i'm having some overflow problem or not, but my problem is ...