徐州I
#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的更多相关文章
- Trace 2018徐州icpc网络赛 (二分)(树状数组)
Trace There's a beach in the first quadrant. And from time to time, there are sea waves. A wave ( xx ...
- 2018 ICPC 徐州网络赛
2018 ICPC 徐州网络赛 A. Hard to prepare 题目描述:\(n\)个数围成一个环,每个数是\(0\)~\(2^k-1\),相邻两个数的同或值不为零,问方案数. solution ...
- 徐州网络赛B-BE,GE or NE【记忆化搜索】【博弈论】
In a world where ordinary people cannot reach, a boy named "Koutarou" and a girl named &qu ...
- 徐州网络赛A-Hard To Prepare【dp】【位运算】【快速幂】
After Incident, a feast is usually held in Hakurei Shrine. This time Reimu asked Kokoro to deliver a ...
- 徐州网络赛J-Maze Designer【最小生成树】【LCA】
After the long vacation, the maze designer master has to do his job. A tour company gives him a map ...
- 徐州网络赛G-Trace【线段树】
There's a beach in the first quadrant. And from time to time, there are sea waves. A wave ( xx , yy ...
- 徐州网络赛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 ...
- 徐州网络赛F-Feature Trace【暴力】
Morgana is learning computer vision, and he likes cats, too. One day he wants to find the cat moveme ...
- 徐州网络赛C-Cacti Lottery【DFS】
54.19% 2000ms 262144K Morgana is playing a game called cacti lottery. In this game, morgana has a 3 ...
- 计蒜客 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 ...
随机推荐
- C/C++知识总结 一 C/C++常识概述
C/C++常识概述 程序与计算机语言 C/C++简介与发展 C/C++异同 C/C++编译特点 学习编程建议 程序与计算机语言 程序:是一组计算机能识别和执行.预先编好的一些指令操作合集. 计算机语言 ...
- 万字长文带你入门Zookeeper!!!
导读 文章首发于微信公众号[码猿技术专栏],原创不易,谢谢支持. Zookeeper 相信大家都听说过,最典型的使用就是作为服务注册中心.今天陈某带大家从零基础入门 Zookeeper,看了本文,你将 ...
- PTA数据结构与算法题目集(中文) 7-34
PTA数据结构与算法题目集(中文) 7-34 7-34 任务调度的合理性 (25 分) 假定一个工程项目由一组子任务构成,子任务之间有的可以并行执行,有的必须在完成了其它一些子任务后才能执行.“ ...
- php __DIR__ 解释下
__DIR__, php5.3 才增加的这个魔术常量,表示当前文件所在的目录地址. php5.3之前用dirname(__FILE__);表示__DIR__; __FILE__这个表示当前文件的路径.
- Vulnhub DC-4靶机渗透
信息搜集 nmap -sP 192.168.146.0/24 #扫网段看看存活的主机,找到靶机 nmap -sS -Pn -A 192.168.146.141 可以看到开放了22和80端口,那么就可以 ...
- NS网络仿真,小白起步版,双节点之间的模拟仿真(基于TCP和FTP流)
set ns [new Simulator] set tracefd [open one.tr w] #开启跟踪文件,记录分组传送的过程 $ns trace-all $tracefd set namt ...
- Powershell抓取网页信息
一般经常使用invoke-restmethod和invoke-webrequest这两个命令来获取网页信息,如果对象格式是json或者xml会更容易 1.invoke-restmethod 我们可以用 ...
- 【高并发】高并发环境下如何优化Tomcat配置?看完我懂了!
写在前面 Tomcat作为最常用的Java Web服务器,随着并发量越来越高,Tomcat的性能会急剧下降,那有没有什么方法来优化Tomcat在高并发环境下的性能呢? Tomcat运行模式 Tomca ...
- AJ学IOS(25)UI之触摸事件
AJ分享,必须精品 iOS中的事件 在用户使用app过程中,会产生各种各样的事件;iOS中的事件可以分为3大类型: 响应者对象–UIResponder 在iOS中不是任何对象都能处理事件,只有继承了U ...
- GitHub 热点速览 Vol.16:化身蒙娜丽莎和乔布斯对话
摘要:妙趣横生,上周的 GitHub 热点的关键词.无论是让你化身为爱因斯坦开启会议脑暴模式 avatarify,还是和上周人人都是抠图师项目的同门项目 3D 照片修复:3d-photo-inpain ...