摘要:
贪心的运用,主要看其比值,取最大值实现贪心... 1 #include 2 #include 3 #include 4 using namespace std; 5 6 struct room 7 { 8 int j; 9 int f;10 bool operator (f... 阅读全文
2014年4月20日
摘要:
1 #include 2 #include 3 using namespace std; 4 5 int pow(int a,int b) 6 { 7 int ans = 1; 8 while(b--) 9 {10 ans *= a;11 }12 ... 阅读全文
摘要:
1 #include 2 #include 3 using namespace std; 4 5 int main() 6 { 7 //freopen("input.txt","r",stdin); 8 int a,b; 9 char op;10 int T;11... 阅读全文
摘要:
勾股定理... 1 #include 2 #include 3 using namespace std; 4 5 int main() 6 { 7 //freopen("input.txt","r",stdin); 8 int s[3]; 9 int T;10 in... 阅读全文
摘要:
1 #include 2 #include 3 int main() 4 { 5 //freopen("input.txt","r",stdin); 6 int i; 7 char a[1000]; 8 while(gets(a)) 9 {10 ... 阅读全文
摘要:
采用异或... 1 #include 2 int main() 3 { 4 //freopen("input.txt","r",stdin); 5 int n,s,a; 6 while(scanf("%d",&n),n) 7 { 8 s = 0; 9 ... 阅读全文
摘要:
很简单的算法基础题...闰年判断以及计算 1 #include 2 #include 3 using namespace std; 4 int main() 5 { 6 //freopen("input.txt","r",stdin); 7 int year,n; 8 int... 阅读全文
摘要:
与2833差不多基本上只是merge函数那里的优先做父亲的条件改一下便可提高效率... 1 //The Suspects 2 #include 3 #include 4 int parent[30001]; 5 int find(int i) 6 { 7 while(parent[i] >=... 阅读全文
摘要:
第一次敲并查集... 1 #include 2 #include 3 int parent[100002];//注意下标值,不然交了会segmentation fault 4 int find(int i) 5 { 6 while(parent[i] >= 0) 7 i = ... 阅读全文