This is an example that shows how to redirect (forward) to a new page in PHP.
View this problem on POJ: 1129 Channel Allocation This problem involves the following knowledge:
View the Problem.
This problem can be solved by 2 methods.
View this problem on POJ: 1190 Birthday Cake (生日蛋糕)
There is no good methods, maybe dynamic programing is feasible, but it’s too complex for me to construct the transformation equation.
I have to use DFS (Depth First Search) to solve this problem. After the TLE (Time Limit Exceeds) appeared enough times, I worked it out. Pruning is very important for this problem.
View this problem on POJ: 1838 Banana.
This problem can be categorized as the Union-Find problem.
View the problem description here: 2104 K-th Number .
To solve this problem, you need to learn the following knowledge first.
- Segment Tree
- Binary Search
- Merge Sort
If you know all the above, it’s easy to solve this problem.
Wow, Compaq Evo N610c…It’s really an old machine… I searched the configure file for this machine, and fond only one page, but it’s too old to work for the latest Gentoo system. Here is my configure file, which costs me days of work.
View this problem on POJ: 1990 MooFest.
Here is my resolution:
This problem can be solved by two methods
- Deepth First Search (DFS)
- Dynamic Programming (DP)
Here is my pseudo code
To install SCIM, follow the following steps:
In some cases, we just want to if an element exists in a sorted list, then we can use the STL function:
To use this function, you must include the header
Note before we use
binary_search(), the list must be sorted, either in ascending order or in descending order.
Here is a simpler example explaining how to use this function.
long long is a standard C++ type, so if you use gcc, you can use this type without any problem.
But on Windows, as some old Microsoft C++ compilers don’t support the type
long long, you have to use the non-standard type:
The following example shows how to input and output an
__int64 type of variable.
Open a terminal, and run the following command:
Here is the script to replace all strings in a file.
By now, the fastest comparison sorting algorithm is \(Ο(N\log N)\). The
sort() function in STL implemented with an optimized quicksort, which is always \(O(N\log N)\).
Here is an example:
In Python, we have tuple, and in Java, we have Map, but in C++, the language itself doesn’t contain anything equivalent. Nevertheless, we can use STL - the Standard Template Library - to construct the data structure.
Of course, we can construct this by ourself, and it’s not complex, but as we will see, with “pair” we can make it easier and simpler.
This is an example:
To record the time your program costs, you can use the function
clock(), that is defined in
Here is an example showing how to use this function: