#include<bits/stdc++.h>using namespace std;typedef long long unsigned ll;#define rep(i,a,b) for(ll i=a;i<=b;++i)#define per(i,a,b) for(ll i=a;i>=b;--i)const ll N=1000005,base=131,mod=212370440130137957ll;ll n,m,k,q,now=0,c[N];char s[N];signed main(){//ios::sync_with_stdio(false);scanf("%s",s+1);n=strlen(s+1);ll a=0,b=0,w=1;for(ll i=1;i<=n;++i){a=(a*base+s[i]);//cout<<a<<" ";b=((w*s[n-i+1])+b);w=(w*base);//cout<<b<<endl;if(a==b)c[i]=++now;else c[i]=now;}//for(ll i=1;i<=n;++i)cout<<c[i]<<" ";cout<<endl;scanf("%lld",&q);for(ll i=1;i<=q;++i){ll x;scanf("%lld",&x);ll mi=min(x,n-x+1)-1;printf("%lld\n",c[mi]);}//cerr<<endl<<"carnation13"<<endl;return 0;}
总结:新队伍的第二场vp,比上一场签完到就各种痛苦wa不会写的情况要好一点,五题其实是在三个小时多点的时候完成的,如果是实际比赛可能能出更多的题(可能吧),这个赛季加油了 。
经验总结扩展阅读
- 2021下半年苹果出什么手机_ 苹果2021年即将上市新款手机
- 2021年的春节天气情况_2021年大年初一天气预报
- 2021.9月份穿越火线烟雾怎么调(穿越火线烟雾频率怎么调)
- iPadPro2021参数配置_iPadPro2021详细参数介绍
- 日本举办的奥运会次数
- 2021年双十一小米11会降价吗_双十一小米11能便宜多少
- 支付宝蚂蚁庄园10月23日答题解析
- 郑州发水原因
- skii神仙水新年限量版2021_限量版神仙水和普通神仙水有什么区别吗
- 2021年生肖兔的财运怎么样