Fatigued by the endless toils of farming, Farmer John has decided to try his hand in the MP3 player market with the new iCow. It is an MP3 player that stores N songs (1 ≤ N ≤ 1,000) indexed 1 through N that plays songs in a "shuffled" order, as…
题目链接:http://poj.org/problem?id=2363 思路分析:由于数据较小,采用暴力搜索法.假设对于矩形边长 1 <= a <= b <= c <= N; 由于 c = N / (a * b), c必须满足条件:为整数且不小于b. 代码如下: #include <iostream> using namespace std; int main() { int n, min_area; double a, b, c, volume; cin >&…
题目链接:http://poj.org/problem?id=1731 思路分析:含有重复元素的全排列问题:元素个数为200个,采用暴力枚举法. 代码如下: #include <iostream> #include <algorithm> using namespace std; + ; void PrintPermu( int n, char P[], char A[], int cur ) { int i, j; if ( cur == n ) { ; i < n; ++…
题目链接:http://poj.org/problem?id=2912 Time Limit: 5000MS Memory Limit: 65536K Description N children are playing Rochambeau (scissors-rock-cloth) game with you. One of them is the judge. The rest children are divided into three groups (it is possible t…
http://poj.org/problem?id=3414 记录瓶子状态,广度优先搜索即可 #include <cstdio> #include <cstring> #include <queue> using namespace std; const int maxn=101; int n,m; typedef unsigned long long ull; int A,B,C; int vis[maxn][maxn]; int ans[maxn][maxn][ma…
Description Consider equations having the following form: a1x13+ a2x23+ a3x33+ a4x43+ a5x53=0 The coefficients are given integers from the interval [-50,50]. It is consider a solution a system (x1, x2, x3, x4, x5) that verifies the equation, xi∈[-5…