Search found 23 matches
- Thu Sep 17, 2009 3:51 am
- Forum: Volume 116 (11600-11699)
- Topic: 11664 - Langton's Ant
- Replies: 10
- Views: 4061
Re: 11664 - Langton's Ant
Thanks jurajz! I changed my function to: string div2(const string& s) { const int SIZE = s.size(); const int TWO = 2; string r; int ten = 0; for(int i = 0; i < SIZE; ++i) { int digit = (s[i] - '0') + ten; if(digit % TWO == 0) { r += (digit / TWO) + '0'; } else { if(digit != 1) { r += (digit / TW...
- Wed Sep 09, 2009 9:56 pm
- Forum: Volume 116 (11600-11699)
- Topic: 11664 - Langton's Ant
- Replies: 10
- Views: 4061
Re: 11664 - Langton's Ant
I have a problem with the input case: 16 115792089237316195423570985008687907853269984665640564039457584007913129639935 16 15 I have checked and rechecked the code, but I can't find the error! Thanks #include <iostream> #include <vector> using namespace std; enum Direction { NORTH = 0, EAST = 1, SOU...
- Tue Apr 28, 2009 12:32 am
- Forum: Algorithms
- Topic: BFS
- Replies: 2
- Views: 3187
BFS
I was trying to solve problem 532 Dungeon Master This code got TLE (in 3 sec. it didn't solve the problem): struct Node { int x; int y; int z; int distance; Node(int x = -1, int y = -1, int z = -1, int d = 0) : x(x), y(y), z(z), distance(d) {}; }; int bfs(const vector< vector<string> >& map, con...
- Wed Apr 08, 2009 4:39 pm
- Forum: Algorithms
- Topic: Minimal circle
- Replies: 2
- Views: 2625
Minimal circle
Minimal Circle http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1450 What I was thinking is: for n <= 3 points I used the obvious formulas. For n > 3: First to use the Akl Touissant heuristic to calculate Convex Hull (look for the 4 extreme points and remove any interior points to that q...
- Tue Mar 03, 2009 4:36 pm
- Forum: Other words
- Topic: Good books/resources on algorithms
- Replies: 2
- Views: 4523
- Tue Mar 03, 2009 4:21 pm
- Forum: Other words
- Topic: PKU # 3003 - Spiderman’s workout
- Replies: 0
- Views: 2886
PKU # 3003 - Spiderman’s workout
Spiderman’s workout I'm starting with: function workout(int h, vector<int> d, int idx) { if(idx == d.size()) { // There are no more distances return (h == 0) ? EXIT : FAIL; // Did I return to the ground? } if(h < d[i]) { // I can only go Up return workout(h + d[i], d, i+1); } return optimal(workout...
- Mon Oct 13, 2008 8:55 pm
- Forum: Volume 115 (11500-11599)
- Topic: 11513 - 9 Puzzle
- Replies: 10
- Views: 5262
Re: 11513 - 9 Puzzle
This is what I did in my AC code: Do a BFS-like algorithm: Have a cache of solutions and a queue. Put in the queue the initial state "123456789" which has solution "" and moves=0 While there are states in the queue: Process the actual state Create all 6 neighbors states If the ne...
- Mon Sep 29, 2008 8:35 pm
- Forum: Volume 112 (11200-11299)
- Topic: 11283 - Playing Boggle
- Replies: 19
- Views: 8789
Re: 11283 - Playing Boggle
Thanks 898989!
That was the mistake! (I can't believe how did I miss it) I finally got AC
That was the mistake! (I can't believe how did I miss it) I finally got AC

- Mon Sep 29, 2008 5:21 am
- Forum: Volume 112 (11200-11299)
- Topic: 11283 - Playing Boggle
- Replies: 19
- Views: 8789
11283 - Playing Boggle
I'm getting WA. A low "Total Submissions / Solving %" with a high "Total Users / Solving %" usually means a tricky input. The problem says "A blank line always precedes the letter grid" It seems like a clue but I can't figure it out. Thanks! My code: Removed after AC
- Tue Sep 09, 2008 11:14 pm
- Forum: Volume 114 (11400-11499)
- Topic: 11470 - Square Sums
- Replies: 9
- Views: 4235
11470 - Square Sums
This post is not about asking for help so much as sharing approaches: I travel the given square in a spiral-way adding the integers I find. When I get to a visited cell I tried to turn right and continue. After visiting all cells I stop. Every time I turn and I'm facing right I store the value of th...
- Fri Sep 05, 2008 8:12 pm
- Forum: Volume 113 (11300-11399)
- Topic: 11335 - Discrete Pursuit
- Replies: 15
- Views: 6256
Re: 11335 - Discrete Pursuit
I honestly don't know where to begin to attack this problem but it seems that this problem is really easy.
Could anyone give me a little hints about where to start?
By the way: I don't know what the other posters are meaning about x component and y component.
Thanks a lot.
Could anyone give me a little hints about where to start?
By the way: I don't know what the other posters are meaning about x component and y component.
Thanks a lot.
- Sat Jan 12, 2008 8:03 pm
- Forum: Volume 100 (10000-10099)
- Topic: 10099 - The Tourist Guide
- Replies: 91
- Views: 31305
Re: I don`t know wrong in my code
I don`t know.. what`s wrong? Plz Help me :cry: I'm using the same idea but also get WA. At first I thought that your error was really a PE because of: cout << "Minimum Number of Trips = " << result << endl << endl; But it still got WA. My code is: #include <iostream> #include <vector> #in...
- Wed Jan 02, 2008 4:12 am
- Forum: Volume 105 (10500-10599)
- Topic: 10500 - Robot maps
- Replies: 45
- Views: 14478
- Sat Dec 01, 2007 4:29 am
- Forum: Volume 113 (11300-11399)
- Topic: 11333 - Alphametics
- Replies: 3
- Views: 1799
The first time I tried to backtrack but I got discouraged because I supposed that I will never solve in time. What I had in mind was to: 1- Count the number of characters in all the equation if is more than 10 then do nothing. 2- Backtrack trying to guess numbers from 0 to 9 for every non-replaced-y...
- Tue Oct 30, 2007 7:50 am
- Forum: Volume 104 (10400-10499)
- Topic: 10422 - Knights in FEN
- Replies: 49
- Views: 18892
This reply took 1 year but in case anyone cares anymore, yes the correct output is "Solvable in 8 move(s)."DP wrote:Can someone tell me, how the following Input produce 8 move(s) for knight?I found it from board. PLease help me!!!Code: Select all
11111 00111 00111 0 001 00000