Could you give me a link?maxdiver wrote:you could find this book in the Internet in a free electronic version.

## Search found 215 matches

- Wed Nov 14, 2007 7:52 am
- Forum: Algorithms
- Topic: Suffix tree construction
- Replies:
**13** - Views:
**4990**

- Wed Nov 14, 2007 7:20 am
- Forum: Algorithms
- Topic: K'th Shortest Path
- Replies:
**6** - Views:
**3636**

The offical report of Yokohama 2006 gives the algorithm.

- Fri Oct 12, 2007 10:58 am
- Forum: Algorithms
- Topic: K'th Shortest Path
- Replies:
**6** - Views:
**3636**

- Mon Oct 08, 2007 2:12 pm
- Forum: C++
- Topic: Compile error on priority_queue.
- Replies:
**6** - Views:
**3815**

- Mon Oct 08, 2007 10:49 am
- Forum: C++
- Topic: Compile error on priority_queue.
- Replies:
**6** - Views:
**3815**

You can try, I change the line
to
still the same compilation error.

Code: Select all

`priority_queue<int> que( MyLess(a) ); `

Code: Select all

`priority_queue<int, vector<int>, MyLess> que( MyLess(a) );`

- Mon Oct 08, 2007 4:53 am
- Forum: C++
- Topic: Compile error on priority_queue.
- Replies:
**6** - Views:
**3815**

### Compile error on priority_queue.

#include <queue> using namespace std; struct MyLess: public less<int> { const int* a; MyLess(const int* _a) { a = _a; } bool operator () (int i, int j) const { return a[i] > a[j]; } }; int main() { int a[100]; priority_queue<int> que( MyLess(a) ); que.push(1); return 0; } But I get this compilation...

- Sat Oct 06, 2007 4:25 am
- Forum: Algorithms
- Topic: Number of different necklets.
- Replies:
**16** - Views:
**4907**

- Fri Oct 05, 2007 2:35 pm
- Forum: Algorithms
- Topic: Number of different necklets.
- Replies:
**16** - Views:
**4907**

- Thu Oct 04, 2007 5:27 pm
- Forum: Algorithms
- Topic: Number of different necklets.
- Replies:
**16** - Views:
**4907**

So what's
Am I right?

I just see in your output, when N is multiple of 2003, the answer is always 0.

*Euler's theorem*? From your code I think it is:Code: Select all

`(a / N) % m == (a * N ^ m - 2) % m. Only for gcd(N, m) == 1`

I just see in your output, when N is multiple of 2003, the answer is always 0.

- Thu Oct 04, 2007 7:17 am
- Forum: Algorithms
- Topic: Number of different necklets.
- Replies:
**16** - Views:
**4907**

Sorry, I don't quite understand the Just find modular inverse of N, and multiply by it . In my algorithm, if I want to get the solution for N = 99999 and N = 99998, I need to do 2 times of DP, one O(7*7*7*99999) and one O(7*7*7*99998). That makes my program slow. I think your algorithm can get all t...

- Thu Oct 04, 2007 6:25 am
- Forum: Algorithms
- Topic: Number of different necklets.
- Replies:
**16** - Views:
**4907**

The answer is right, but the speed is a little bit slow. In fact, the requirement of the problem is to output the answer mod 2003, not mod 10000. If without the last dividing by N , just mod 2003, I can mod dp[n][j][k] by 2003 at every step of the DP. But now with the dividing by N at last, it is a ...

- Tue Oct 02, 2007 10:00 am
- Forum: Algorithms
- Topic: Number of different necklets.
- Replies:
**16** - Views:
**4907**

OK, now the output seems to be right. Thank you.

Could you give some link to the

Could you give some link to the

*Burnside's lemma*? I search it on*Math World*and get this page. I don't quite understand what it says.- Tue Oct 02, 2007 9:30 am
- Forum: Algorithms
- Topic: Number of different necklets.
- Replies:
**16** - Views:
**4907**

- Tue Oct 02, 2007 8:17 am
- Forum: Algorithms
- Topic: Number of different necklets.
- Replies:
**16** - Views:
**4907**

- Tue Oct 02, 2007 5:23 am
- Forum: Algorithms
- Topic: Number of different necklets.
- Replies:
**16** - Views:
**4907**

### Number of different necklets.

Given pearls of 7 different colors, to make a necklet. Any two adjacent pearls mustn't have same colors. The first and the last pearls are also adjacent. Given the length of the necklet N (N < 100000). Please calculate the number of different ways to make the necklet. The answer may be very big, jus...