## Search found 114 matches

- Mon Jun 06, 2005 3:17 pm
- Forum: Algorithms
- Topic: Algorithm for Soccer Team Building
- Replies:
**0** - Views:
**809**

### Algorithm for Soccer Team Building

I'm hoping someone can suggest an algorithm for creating soccer teams based on some criteria.. 1) Players suggest 2 or 3 'friends' whom they would like to be on a team with. 2) Teams would be evened out by player weight. 3) Players suggest their favorite position, and would be assigned to teams that...

- Thu Oct 30, 2003 6:59 pm
- Forum: Algorithms
- Topic: Finding the intersection of 3D segments
- Replies:
**1** - Views:
**1719**

### Finding the intersection of 3D segments

Hi guys.. I'm having trouble trying to find the intersection point of two line segments. I found a webpage: http://mathforum.org/library/drmath/view/62814.html that seems helpful, but the last bit is hard to understand. Particularly, the part that says "Once we have checked this, we can solve for 'a...

- Wed Oct 29, 2003 9:08 pm
- Forum: Algorithms
- Topic: finding angle between 3 points
- Replies:
**13** - Views:
**3768**

This was actually a problem with 132 for me. What I was trying to do is draw a line from the centre of mass to each end, then check that the angles of these lines are <= 90 degrees. That way I can check if the point lies between the endpoints. Anyway, it worked and I got accepted. Does anyone know a...

- Wed Oct 29, 2003 6:55 pm
- Forum: Algorithms
- Topic: finding angle between 3 points
- Replies:
**13** - Views:
**3768**

I fixed it with if(Math.abs(end1Angle) > 180) end1Angle += (end1Angle < 0) ? 360 : -360; if(Math.abs(end2Angle) > 180) end2Angle += (end2Angle < 0) ? 360 : -360; It took me a while to figure it out, but it works fine now. As for the reference to P109... I solved that one no problem with the same cod...

- Wed Oct 29, 2003 4:39 pm
- Forum: Algorithms
- Topic: finding angle between 3 points
- Replies:
**13** - Views:
**3768**

Joseph, thanks for trying to help. Unfortunately, my problem is not just with negative angles... It is more with consistency. If I get the angle (2,2)(1,1)(3,1) it should be 45.0 If I get the angle (2,2)(3,1)(1,1) it should be -45.0 (one turns right, the other left) The 4 angles I gave as examples e...

- Wed Oct 29, 2003 3:17 pm
- Forum: Algorithms
- Topic: finding angle between 3 points
- Replies:
**13** - Views:
**3768**

Sorry about the last post, I was rushing so I didn't get to give a good reply. Basically, I want a function that can take three points, A,B,C and return the angle formed by ABC. So I am looking for angle B. My current way is this: [java] public static double getAngle(Point p1, Point p2) { return Mat...

- Wed Oct 29, 2003 12:48 pm
- Forum: Algorithms
- Topic: finding angle between 3 points
- Replies:
**13** - Views:
**3768**

- Tue Oct 28, 2003 10:30 pm
- Forum: Algorithms
- Topic: finding angle between 3 points
- Replies:
**13** - Views:
**3768**

### finding angle between 3 points

I want to find the angle (in degrees) of three points. I am trying to use the java Math.atan2(p1, p2) method, but am not getting what I want. Take for example the points (2, 2)(1, 1)(3, 1) the angle can be found by doing this: angle1 = atan2( (1-1), (1-3) ) angle2 = atan2( (2-1), (2-1) ) angle = ang...

- Wed Oct 15, 2003 8:35 pm
- Forum: Volume 1 (100-199)
- Topic: 114 - Simulation Wizardry
- Replies:
**80** - Views:
**7691**

I converted your funky diagram into an input file:

Which gives the following output:

You did not say what the cost of each bumper was, so I assumed 0.

Code: Select all

```
5 5
0
2
2 2 0 0
3 3 0 0
4 2 3 10
```

Code: Select all

```
0
0
```

- Thu Oct 02, 2003 11:21 pm
- Forum: Volume 1 (100-199)
- Topic: 123 - Searching Quickly
- Replies:
**55** - Views:
**5056**

stcheung: Again sorry for the size of the message. Your problem starts on line #160 (PRIDE and prejudice) the world ACCORDING to garp the ADVENTURES of huckleberry finn out of AFRICA the day AFTER tomorrow AIRPORT the sum of ALL fears the sun ALSO rises AMERIKA farewell ANATOLIA ANIMAL dreams ANNE o...

- Thu Oct 02, 2003 11:16 pm
- Forum: Volume 1 (100-199)
- Topic: 123 - Searching Quickly
- Replies:
**55** - Views:
**5056**

boatfish, your problem exists for this input: the and as for this that with of is a i an at at an it on of in to :: Fire in the Streets Chaos A troubled Feast Amerika A World of Ideas Out of Africa Death of a Salesman Farewell Anatolia Paradise Lost Paradise Regained The Descent of Man The Ascent of...

- Fri Sep 26, 2003 1:29 pm
- Forum: Volume 1 (100-199)
- Topic: 127 - "Accordian" Patience
- Replies:
**83** - Views:
**9421**

Why not implement your own stack? I did, and it only took around 10 lines. That way you are sure that you are doing only what you need. Really, all you need is a push, pop, and top method. Plus, you can statically allocate the memory needed for the stack of cards, whereas if you use the STL stack, e...

- Wed Sep 24, 2003 6:22 pm
- Forum: Other words
- Topic: Java compiler and packages/classes
- Replies:
**1** - Views:
**750**

I don't know exactly what classes the judge supports, but you can get the same compiler. If you are using windows, go download CYGWIN and install it. Then, just download the GCC / GCJ compiler to use with it. I believe you can download older versions of GCC, so if you want your compiler to match the...

- Mon Sep 22, 2003 2:02 pm
- Forum: Volume 1 (100-199)
- Topic: 115 - Climbing Trees
- Replies:
**30** - Views:
**11302**

- Mon Sep 22, 2003 2:00 pm
- Forum: Volume 1 (100-199)
- Topic: 120 - Stacks of Flapjacks
- Replies:
**118** - Views:
**13579**

This problem has a special judge, so it doesn't really matter HOW you sort them, as long as you do. The strategy that is popular here is find the biggest, flip it to the top, then flip it to its final position. So, find the largest, flip it to the top, then flip the entire stack over so the top is n...