#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. Ubuntu命令方式安装中文语言包

    Ubuntu命令方式安装中文语言包 安装之前执行 $LANG 查看语言环境 中文语言包: language-pack-zh-hans 简体中文 language-pack-zh-hans-base l ...

  2. ARM.SchDoc图解

    1.基准电压.CR1220电池 2.LCD 3.SPI 4.外部SAM 5.实时时钟 6.EEPROM 7.JTAG 8.复位

  3. 1037 Magic Coupon (25分)

    The magic shop in Mars is offering some magic coupons. Each coupon has an integer N printed on it, m ...

  4. 完整微信小程序授权登录页面教程

    完整微信小程序授权登录页面教程 1.前言 微信官方对getUserInfo接口做了修改,授权窗口无法直接弹出,而取而代之是需要创建一个button,将其open-type属性绑定getUseInfo方 ...

  5. docker 相关操作

    docker-compose down //关闭所有容器 docker-compose up //开启所有容器 docker-compose restart //重启所有容器 单独更新某个容器时用脚本 ...

  6. 《闲扯Redis四》List数据类型底层编码转换

    一.前言 Redis 提供了5种数据类型:String(字符串).Hash(哈希).List(列表).Set(集合).Zset(有序集合),理解每种数据类型的特点对于redis的开发和运维非常重要. ...

  7. django创建app

    前几天,

  8. 几行代码实现cookie的盗取

    前言 上一篇文章中介绍了XSS(跨站脚本攻击)简单原理与几种类型.接下来通过实例用几行代码实现cookie的盗取. 正文 这里测试用的工具是DVWA(可以本地搭建,前面文章有介绍),和phpstudy ...

  9. AJ学IOS 之第一次打开Xcode_git配置,git简单学习

    AJ分享,必须精品 一:错误 当第一次打开Xcode我们进行commit操作的时候会报错: The working copy “测试” failed to commit files. * Please ...

  10. Project configuration is not up-to-date with pom.xml.错误

    完整错误信息:Description Resource Path Location TypeProject configuration is not up-to-date with pom.xml. ...