标签:ios -- 大数 class main while long bsp int
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; int m,d,head,tail,pos; char op[2]; typedef long long ll; int q[200007],a[200007]; int main(){ while(~scanf("%d%d",&m,&d)){ int t=0,x;head=tail=0; while(m--){ scanf("%s%d",op,&x); if(op[0]==‘A‘){ x=(x+t)%d; a[pos++]=x; if(tail==0){ q[tail++]=pos-1; } else{ while(tail&&a[q[tail-1]]<=x) tail--;//err q[tail++]=pos-1; } } else{ int index=lower_bound(q,q+tail,pos-x+1-1)-q; t=a[q[index]];//err printf("%d\n",a[q[index]]); } } } return 0; }
标签:ios -- 大数 class main while long bsp int
原文地址:http://www.cnblogs.com/linkzijun/p/6574666.html