摘要: 贪心算法 1 #include <iostream> 2 #include <vector> 3 #include <algorithm> 4 5 using namespace std; 6 7 struct Job{ 8 int j,b; 9 bool operator < (const Job& x) const {10 if( j == x.j ) return b < x.b;11 return j > x.j;12 }13 };14 15 int main(){16 int n,iCase = 0;17 w... 阅读全文
posted @ 2013-04-06 23:44 OpenSoucre 阅读(244) 评论(0) 推荐(0) 编辑
摘要: 贪心的思想 1 #include <iostream> 2 #include <algorithm> 3 #include <vector> 4 5 using namespace std; 6 7 int main(){ 8 int n,m; 9 while(cin >> n>>m && n && m){10 vector<int> heads(n),knights(m);11 for(int i = 0; i < n; i ++ ) cin >> heads[i];12 阅读全文
posted @ 2013-04-06 22:55 OpenSoucre 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 基于自底向上的动态规划 1 #include <iostream> 2 #include <cstdio> 3 #include <algorithm> 4 #include <vector> 5 #include <cstring> 6 #include <string> 7 8 #define MAX 1000 9 using namespace std;10 11 12 int a[MAX] = {0}, dp[MAX][MAX] = {0},path[MAX][MAX] = {0}, n;13 14 void ma 阅读全文
posted @ 2013-04-06 20:19 OpenSoucre 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 #include <map> 3 #include <vector> 4 #include <sstream> 5 #include <string> 6 using namespace std; 7 8 int main(){ 9 int T;10 cin>>T;11 for(int iCase = 1; iCase <= T; iCase ++){12 int N,M;13 cin>>N>>M;14 map<string,string& 阅读全文
posted @ 2013-04-06 18:55 OpenSoucre 阅读(327) 评论(2) 推荐(1) 编辑
摘要: 1002. Phone NumbersTime Limit: 2.0 secondMemory Limit: 64 MBIn the present world you frequently meet a lot of call numbers and they are going to be longer and longer. You need to remember such a kind of numbers. One method to do it in an easy way is to assign letters to digits as shown in the follow 阅读全文
posted @ 2013-04-06 00:00 OpenSoucre 阅读(313) 评论(0) 推荐(0) 编辑