随笔分类 -  ACM~~UVA

摘要:贪心算法 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 阅读(259) 评论(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 阅读(176) 评论(0) 推荐(0)