摘要: 树状数组,优化查询 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 using namespace std; 5 const int maxn=5000+10; 6 int n; 7 int a[maxn],c[maxn]; 8 int lowbit(int x) 9 {10 return x&(-x);11 }12 int query(int x)13 {14 int sum=0;15 while(x)16 {17 sum+=c[x];18 x-=... 阅读全文
posted @ 2013-05-20 19:20 LJ_COME!!!!! 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 模拟,标记六个方向的位置为0,1,2。。。,然后记录当前位置六种走法所要朝向的方向,而我们所需要的就是每个位置的这几个方向,很显然,其中的front所得到的方向就是当前所朝向的方向。#include <iostream>#include <cstdio>#include <cstring>using namespace std;struct node{ int front,back,left,right,up,down;};node b_ch(node op){ node tem; tem.front=op.back; tem.back=op.front; 阅读全文
posted @ 2013-05-20 01:15 LJ_COME!!!!! 阅读(142) 评论(0) 推荐(0) 编辑
点击右上角即可分享
微信分享提示