好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

CodeforcesRound#263(Div.1)-A,B,C_html/css_WEB-ITno

A:

dp[i][0]=dp[i][1]=dp[a][0]*dp[b][0]*dp[c][0];

#include #include #include #include#include #include #include #include using namespace std;#define maxn 110000#define LL __int64#define mod 1000000007vector old[maxn];vector now[maxn];int vis[maxn];void change(int x){    int i;    vis[x]=1;    for(i=0; i >=1;    }    return ret;}LL dos(LL x,LL y,LL z){    x=x*z;    x=x%mod;    x=x*q_mod(y,mod-2,mod);    x=x%mod;    return x;}void dfs(int x){    int leap=0;    LL sum=1;    for(int i=0; i   

C:

很明显,如果翻转大于一半,相当于先旋转,然后翻转剩下的。

那么我们最多会翻转2*n个数字。然后就暴力枚举当前的状态。

然后用线段树储存每个节点有多少长度,然后询问的时候区间求和。

#include #include #include #include#include #include #include #include using namespace std;#define maxn 110000#define LL __int64#define mod 1000000007#define mem(a,b) (memset(a),b,sizeof(a))#define lmin 1#define rmax n#define lson l,(l+r)/2,rt r||ll r||rr =r)return sum[rt];    return query(ll,rr,lson)+query(ll,rr,rson);}int leap,st,ed,n;void chu(int p){    if(leap==0)    {        st=st+p;        ed=ed;        for(int i=p; i>=1; i--)        {            have[st+i-1]=have[st+i-1]+have[st-i];            updata(st+i-1,have[st+i-1],root);        }    }    else    {        ed=ed-p;        st=st;        for(int i=p; i>=1; i--)        {            have[ed-i+1]=have[ed-i+1]+have[ed+i];            updata(ed-i+1,have[ed-i+1],root);        }    }}int main(){    int q;    while(~scanf("%d%d",&n,&q))    {        creat(root);        for(int i=1; i ed||b ed)b=ed;                if(a 

查看更多关于CodeforcesRound#263(Div.1)-A,B,C_html/css_WEB-ITno的详细内容...

  阅读:33次