摘要: #include #include using namespace std; int main() { int i,j,n,m,v,c[100100],w[100100],cnt[50001]; cin>>n; while(n--) { cin... 阅读全文
posted @ 2014-12-10 23:00 __夜风 阅读(327) 评论(0) 推荐(0) 编辑
摘要: 以前写的.....拿出来看看.... 并查集模板: #include #include using namespace std; int f[10000]; int find(int x) { if(f[x]==0) return x; return f[x]=find(... 阅读全文
posted @ 2014-12-10 22:56 __夜风 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 以前写的.....贴出来,题目意思大概是找a,b两个人是否有关系... #include #include using namespace std; bool Find; int n,m,flag[30],M[30][30]; void ss(int x,int y) { fla... 阅读全文
posted @ 2014-12-10 22:53 __夜风 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 这是以前写的解题报告吧,虽然很简单....还是贴出来吧,毕竟自己也是从菜鸟一步一步走过来的..... #include #include using namespace std; int main() { stacks; int n; char a[100],b[... 阅读全文
posted @ 2014-12-10 22:48 __夜风 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 题意: y=|a*x^3+b*x^2+c*x+d| 求y的最大值? 题目是bc上的,之前写的时候,没考虑0的情况(太笨了)。。。。 水题吧。。。。 AC代码: #include #include #include #include #define max(a,b) (a>b)?a... 阅读全文
posted @ 2014-12-10 14:02 __夜风 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 题意: 中文自看 大概就是n个人选m个人,然后插板,求有多少种? 插板首先排除头尾,一共有m-1个空,在m-1空里面插入,插入后另外一个就确定了,然后求组合数C(i,n) 水题 AC代码: #include #define LL long longusing namespace std;... 阅读全文
posted @ 2014-12-10 14:01 __夜风 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 水题。。。。 AC代码: #include #include using namespace std;int main(){ char str[1010]; int i,k; while(scanf("%s",&str)!=EOF) { queueq; for(i=0;str[i]!=... 阅读全文
posted @ 2014-12-10 11:57 __夜风 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 题意: 给一组数,然后给多组询问,query(x,y)表示求x到y的数和,add(x,y)表示x上的数加上y,sub(x,y)表示x上的数减去y。 这道题和1698的那题相似,只不过1698的是区间更新,处理要加一个lazy标记,这道题就不用,只是简单的点更新,比1698容易 这两道题的代码... 阅读全文
posted @ 2014-12-10 10:45 __夜风 阅读(127) 评论(0) 推荐(0) 编辑