01 2014 档案

摘要:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2316理解错一点题意就能WA到死。。。题中对于重复的单词,只输出一个,但是重复的单词个数要加上 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 const int N=100010;10 int vis[N];11 vectorv[N];12 mapmp;13 struct node1... 阅读全文
posted @ 2014-01-20 15:57 N_ll 阅读(268) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=1276 1 #include 2 #include 3 const int N=1000020; 4 #define Max(a,b) (a)>(b)?(a):(b) 5 int dp[N],cash; 6 void ZeroOnePack(int cost)//01背包 7 { 8 for (int i = cash; i >= cost; i--) 9 {10 dp[i] = Max(dp[i],dp[i-cost]+cost);11 }12 }13 void ComplexPack(int ... 阅读全文
posted @ 2014-01-19 14:50 N_ll 阅读(176) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=1836求两遍最长上升子序列,顺序求一遍,逆序求一遍。 1 #include 2 #include 3 const int N=1002; 4 int dp1[N],dp2[N]; 5 double a[N]; 6 int main() 7 { 8 int n; 9 scanf("%d",&n);10 for (int i = 1; i a[j])21 {22 if (temp 0; i--)30 {31 int temp = 0... 阅读全文
posted @ 2014-01-18 20:23 N_ll 阅读(151) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=1080 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int INF=1<<28; 8 int score[220][220]; 9 void init()10 {11 score['A']['C']=score['C']['A']=-1;12 score['A']['G']=score['G']['A& 阅读全文
posted @ 2014-01-18 19:16 N_ll 阅读(164) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1166树状数组模板题 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 const int N=50005; 7 int a[N],c[N]; 8 int n; 9 int lowbit(int x)10 {11 return x&(-x);12 }13 int sum(int x)14 {15 int ans = 0;16 while(x > 0)17 {18 an... 阅读全文
posted @ 2014-01-17 09:55 N_ll 阅读(121) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=2352题意:给出每个星星在平面内的坐标(x,y)(y递增,y相同时,x递增)。每颗星星的级别定义为,横纵坐标均不超过自己的星星个数(不包括自己),求级别为0~N-1的星星分别有多少个。 1 #include 2 const int N=32001; 3 int n,c[N],level[N]; 4 int lowbit(int x) 5 { 6 return x&(-x); 7 } 8 int sum(int x)//求和 9 {10 int s = 0;11 while(x>0)12 {13 ... 阅读全文
posted @ 2014-01-16 17:40 N_ll 阅读(176) 评论(0) 推荐(0)