摘要:
http://poj.org/problem?id=2299看到题目想到的就是归并排序....然后文哥告诉我是树状数组,等下再去看看树状数组怎么写,会可以求出逆序对。View Code 1 #include <iostream> 2 using namespace std; 3 const int maxn = 500005; 4 long ans[maxn],fark[maxn]; 5 long long temp; 6 void merge(int p,int q,int r) 7 { 8 int i,j,l; 9 i=p;10 j=q+1;11 l=p;... 阅读全文
posted @ 2012-09-21 20:49
YORU
阅读(172)
评论(0)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=4339二分查找,这里的二分查找有点特别,因为low虽然在边,但是作为比较的左值是不变的。View Code 1 #include <stdio.h> 2 #include <iostream> 3 #include <string.h> 4 using namespace std; 5 const int maxn = 1000005; 6 int ans[maxn]; 7 char str1[maxn],str2[maxn]; 8 int lowbit(int x) 9 阅读全文
posted @ 2012-09-21 19:16
YORU
阅读(132)
评论(0)
推荐(0)
摘要:
http://baike.baidu.com/view/157384.htm?subLemmaId=157384&fromenter=%D6%D0%B9%FA%CA%A3%D3%E0%B6%A8%C0%EDhttp://zh.wikipedia.org/wiki/%E4%B8%AD%E5%9B%BD%E5%89%A9%E4%BD%99%E5%AE%9A%E7%90%86 注释:三数为a b c,余数分别为 m1 m2 m3,%为求余计算,&&是“且”运算 1、分别找出能被两个数整除,而满足被第三个整除余一的最小的数。 k1%b==k1%c==0 && k 阅读全文
posted @ 2012-09-21 10:36
YORU
阅读(325)
评论(0)
推荐(0)
摘要:
http://poj.org/problem?id=1195早上起来A题,结果隔壁寝室的不知道在争论什么,声音真是大。。。。让人都静不下心来。。View Code 1 #include <iostream> 2 #include <stdio.h> 3 using namespace std; 4 const int maxn = 1050; 5 int ans[maxn][maxn]; 6 7 int lowbit(int x) 8 { 9 return x & (-x);10 }11 12 void mod(int temp[], int x, int c) 阅读全文
posted @ 2012-09-21 09:01
YORU
阅读(143)
评论(0)
推荐(0)

浙公网安备 33010602011771号