摘要: [转自note_me!:http://blog.sina.com.cn/s/blog_8a3a5a12010101mr.html]執行以下命令:1:sudo service network-manager stop2:sudo rm /var/lib/NetworkManager/NetworkManager.state3:sudo service network-manager start即可解決。 阅读全文
posted @ 2012-06-23 21:21 zxfx100 阅读(200) 评论(0) 推荐(0) 编辑
摘要: m,n为正奇数且互质,在[1,m*n]上的m*n个正整数中,有m*n-1个正整数或为m的倍数或为n的倍数。将这m*n-1个数升序排序,记为a[1],a[2],...,a[m+n-1]。另设b,其中b[i]=(-1)^i*(a[i]-a[i-1])(a[0]=0,i=1,2,...,m+n-1)。 求证:sigma(b[i])=-1(i=1,2,...,m+n-1)。 例:m=3,n=5时,a[1]=3,a[2]=5,a[3]=6,a[4]=9,a[5]=10,a[6]=12,a[7]=15,b[1]=-3,b[2]=2,b[3]=-1,b[4]=3,b[5]=-1,b[6]=2,b[7... 阅读全文
posted @ 2012-03-11 22:27 zxfx100 阅读(223) 评论(0) 推荐(0) 编辑
摘要: /* sscanf example */#include <stdio.h>int main (){ char sentence []="Rudolph is 12 years old"; char str [20]; int i; sscanf (sentence,"%s %*s %d",str,&i); printf ("%s -> %d\n",str,i); return 0;}Output:Rudolph -> 12 阅读全文
posted @ 2012-03-04 22:01 zxfx100 阅读(202) 评论(0) 推荐(0) 编辑
摘要: // next_permutation#include <iostream>#include <algorithm>using namespace std;int main () { int myints[] = {1,2,3}; cout << "The 3! possible permutations with 3 elements:\n"; sort (myints,myints+3); do { cout << myints[0] << " " << myints[1] &l 阅读全文
posted @ 2011-11-09 15:47 zxfx100 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 比赛时候没搞出来,在赛后好像只能提交不能评测不知道为什么,故我也不知道自己搞得对不对。不过这道题让我会用了map(看了同一房间里面的一个大牛的代码后,而且这个大牛是个中学生好像……)。#include <algorithm>#include <bitset>#include <cctype>#include <cmath>#include <cstdio>#include <cstdlib>#include <cstring>#include <ctime>#include <deque> 阅读全文
posted @ 2011-10-14 21:17 zxfx100 阅读(241) 评论(0) 推荐(0) 编辑
摘要: Becausemapcontainers do not allow for duplicate keys, this means that the function actually returns 1 if an element with that key is found, and zero otherwise.// map::count#include <iostream>#include <map>using namespace std;int main (){ map<char,int> mymap; char c; mymap ['a&# 阅读全文
posted @ 2011-10-13 22:07 zxfx100 阅读(392) 评论(0) 推荐(0) 编辑
摘要: // accessing mapped values#include <iostream>#include <map>#include <string>using namespace std;int main (){ map<char,string> mymap; mymap['a']="an element"; mymap['b']="another element"; mymap['c']=mymap['b']; cout << 阅读全文
posted @ 2011-10-13 21:58 zxfx100 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 纪念一下这道题,写了一下午+一晚上,结果WA后才发现输出的不是拓扑排序。Exhausting....还是先做作业以后再补了…… 过了两天,不管怎么说参考着一些别人的程序总算是写完了,大循环以位置为顺序一个个试人试下去,SCDP小循环以状态为顺序并考虑拓扑排序(这时候是以人的顺序来排位置的)实现状态转移。很长的一句话其实就是对于每个位置去试人并且每试一个人做一次全部的状态转移。贴个代码(YM zYc学长,看了他那个简洁完美的递推程序之后自己的程序写着写着就发现越来越接近他的程序了= =),虽然很想写解题报告但是还有作业要赶。。#include <iostream>#include & 阅读全文
posted @ 2011-09-26 21:00 zxfx100 阅读(208) 评论(0) 推荐(0) 编辑
摘要: // unique algorithm example#include <iostream>#include <algorithm>#include <vector>using namespace std;bool myfunction (int i, int j) { return (i==j);}int main () { int myints[] = {10,20,20,20,30,30,20,20,10}; // 10 20 20 20 30 30 20 20 10 vector<int> myvector (myints,myints+ 阅读全文
posted @ 2011-09-01 21:26 zxfx100 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 虽然不知道为什么……C++ code:#include <iostream>#include <cstdio>#include <cstring>#define MAXN 200#define inf 1000000000using namespace std;int limit_max_flow(int, int [][MAXN], int [][MAXN], int, int, int [][MAXN]);void _max_flow(int, int [][MAXN], int, int, int [][MAXN]);int main(){ int n 阅读全文
posted @ 2011-07-16 23:05 zxfx100 阅读(268) 评论(0) 推荐(0) 编辑