#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. override 重写

    //override:子类继承父类,子类重写父类的方法 public class override { public static void main(String[] args) { horse h ...

  2. echarts设置图标图例legend多种形状

    legend: {   icon: "circle",   //  字段控制形状  类型包括 circle,rect,line,roundRect,triangle,diamond ...

  3. docker下简单搭建redis

    前提是我们已经安装了docker 一.拉取官方镜像,标签为3.2 # docker pull redis:3.2 等待下载完成后我,我们可以在本地镜像列表中查到repository 为redis,标签 ...

  4. PTA | 1014 福尔摩斯的约会 (20分)

    大侦探福尔摩斯接到一张奇怪的字条:我们约会吧! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm.大侦探很快就明白了,字条上奇 ...

  5. 搭建 sqli SQL注入练习靶场

    文章更新于:2020-02-18 按照惯例,需要的文件附上链接放在文首 文件名:sqli-labs-master.zip 文件大小:3.5 M 下载链接:https://www.lanzous.com ...

  6. 7L-双线链表实现

    链表是基本的数据结构,尤其双向链表在应用中最为常见,LinkedList 就实现了双向链表.今天我们一起手写一个双向链表. 文中涉及的代码可访问 GitHub:https://github.com/U ...

  7. [Python] 字符串加密解密

    1. 最简单的方法是用base64: import base64 s1 = base64.encodestring('hello world') s2 = base64.decodestring(s1 ...

  8. 30.4 Map HashMap

    本文将会讲解到: Map和Collection的对比 Map接口的使用,实现类HashMap的使用 /* * 需求:实现学号和姓名这样有对应关系的数据存储 * 为了体现这种有对应关系的数据,我们使用以 ...

  9. 震撼!全网第一张源码分析全景图揭秘Nginx

    不管是C/C++技术栈,还是PHP,Java技术栈,从事后端开发的朋友对nginx一定不会陌生. 想要深入学习nginx,阅读源码一定是非常重要的一环,但nginx源码量毕竟还是不算少,一不小心就容易 ...

  10. git配置用户名

    git config --global user.name [name] git config --global user.email [email_address]