#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define ms(arr,a) memset(arr,a,sizeof arr)
#define debug(x) cout<<"< "#x" = "<<x<<" >"<<endl
const int maxn=1e6+5;
char s[maxn];
int n;
char c[2];
int main()
{
//freopen("Input.txt","r",stdin);
//freopen("Output.txt","w",stdout);
int T;scanf("%d",&T);
while(T--)
{
scanf("%d%s%s",&n,c,s);
int ans=n*2;
int i=0;
while(i<n&&s[i]==c[0]){ans=ans-2;i++;}
if(i==n){printf("1\n");continue;}
int tmp=s[i]-c[0]>=0?s[i]-c[0]:c[0]-s[i];
if(tmp<10)ans--;
printf("%d\n",ans);
}
//freopen("CON","w",stdout);
//system("start Output.txt");
}

徐州I的更多相关文章

  1. Trace 2018徐州icpc网络赛 (二分)(树状数组)

    Trace There's a beach in the first quadrant. And from time to time, there are sea waves. A wave ( xx ...

  2. 2018 ICPC 徐州网络赛

    2018 ICPC 徐州网络赛 A. Hard to prepare 题目描述:\(n\)个数围成一个环,每个数是\(0\)~\(2^k-1\),相邻两个数的同或值不为零,问方案数. solution ...

  3. 徐州网络赛B-BE,GE or NE【记忆化搜索】【博弈论】

    In a world where ordinary people cannot reach, a boy named "Koutarou" and a girl named &qu ...

  4. 徐州网络赛A-Hard To Prepare【dp】【位运算】【快速幂】

    After Incident, a feast is usually held in Hakurei Shrine. This time Reimu asked Kokoro to deliver a ...

  5. 徐州网络赛J-Maze Designer【最小生成树】【LCA】

    After the long vacation, the maze designer master has to do his job. A tour company gives him a map ...

  6. 徐州网络赛G-Trace【线段树】

    There's a beach in the first quadrant. And from time to time, there are sea waves. A wave ( xx , yy  ...

  7. 徐州网络赛H-Ryuji doesn't want to study【线段树】

    Ryuji is not a good student, and he doesn't want to study. But there are n books he should learn, ea ...

  8. 徐州网络赛F-Feature Trace【暴力】

    Morgana is learning computer vision, and he likes cats, too. One day he wants to find the cat moveme ...

  9. 徐州网络赛C-Cacti Lottery【DFS】

    54.19% 2000ms 262144K Morgana is playing a game called cacti lottery. In this game, morgana has a 3 ...

  10. 计蒜客 1460.Ryuji doesn't want to study-树状数组 or 线段树 (ACM-ICPC 2018 徐州赛区网络预赛 H)

    H.Ryuji doesn't want to study 27.34% 1000ms 262144K   Ryuji is not a good student, and he doesn't wa ...

随机推荐

  1. STM32F103ZET6的中断管理

    1.STM32的中断 STM32的中断管理是属于内核部分的,所以中断管理的寄存器也是属于内核组,不属于芯片外设,在查看相关资料的时候,需要查看相对应的内核手册. STM32F103ZET6是Corte ...

  2. PTA数据结构与算法题目集(中文) 7-38寻找大富翁 (25 分)

    PTA数据结构与算法题目集(中文)  7-38寻找大富翁 (25 分) 7-38 寻找大富翁 (25 分)   胡润研究院的调查显示,截至2017年底,中国个人资产超过1亿元的高净值人群达15万人.假 ...

  3. 微信小程序实现滑动tab切换和点击tab切换并显示相应的数据(附源代码)

    这里主要用到了swiper组件和三目运算,直接上代码, 样式只有三个class,简单粗暴,懒的小伙伴们可以直接拿来用,喜欢的点个支持 <view> <view class=" ...

  4. C语言学生管理系统完善版

    #include<stdio.h>#include<string.h>#include <stdlib.h>#define M 100struct score    ...

  5. 下载SVN项目代码

    1. 到SVN根目录右键选中SVN Checkout...

  6. tcp协议:三次握手四次挥手详解-转

    https://www.cnblogs.com/welan/p/9925119.html

  7. HBase协处理器加载的三种方式

    本文主要给大家罗列了HBase协处理器加载的三种方式:Shell加载(动态).Api加载(动态).配置文件加载(静态).其中静态加载方式需要重启HBase. 我们假设我们已经有一个现成的需要加载的协处 ...

  8. 2020年iOS进阶面试题总结(一)

    准备找工作的你,可以看看,复习复习!! 1.说一下OC的反射机制 在动态运行下我们可以构建任何一个类,然后我们通过这个类知道这个类的所有的属性和方法,并且如果我们创建一个对象,我们也可以通过对象找到这 ...

  9. Java方法的重点

    方法就是完成功能一个语句集合体 使用方法的原则:方法的原子性,一个方法只实现一个功能. 方法的重载 1.函数名必须相同 2.形参列表必须不同(可以是个数不同,类型不同,不然完全一样) 3.返回值可以相 ...

  10. Cilium架构 (Cilium 2)

    Cilium架构 译自:http://docs.cilium.io/en/stable/architecture/ 本文档描述了Cilium的架构.它通过记录BPF数据路径(datapath)的钩子来 ...