B - Tanya and Postcard

从DIY到实战:手把手教你搭建一个媲美吉时利2450的nA级电流源表(附原理图与避坑指南) 本文详细解析如何从零打造nA级精密电流源,涵盖核心设计原理、PCB布局技巧、热电偶效应应对及校准验证体系。通过低成本替代方案和优化设计,实现媲美商用源表的性能,特别适合硬件爱好者和独立开发者。文章还提供原理图与避坑指南,助你轻松搭建高精度电流源系统。 阅读详情

B - Tanya and Postcard
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can’t write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The newspaper contains string t, consisting of uppercase and lowercase English letters. We know that the length of string t greater or equal to the length of the string s.

The newspaper may possibly have too few of some letters needed to make the text and too many of some other letters. That’s why Tanya wants to cut some n letters out of the newspaper and make a message of length exactly n, so that it looked as much as possible like s. If the letter in some position has correct value and correct letter case (in the string s and in the string that Tanya will make), then she shouts joyfully “YAY!”, and if the letter in the given position has only the correct value but it is in the wrong case, then the girl says “WHOOPS”.

Tanya wants to make such message that lets her shout “YAY!” as much as possible. If there are multiple ways to do this, then her second priority is to maximize the number of times she says “WHOOPS”. Your task is to help Tanya make the message.

Input
The first line contains line s (1 ≤ |s| ≤ 2·105), consisting of uppercase and lowercase English letters — the text of Tanya’s message.

The second line contains line t (|s| ≤ |t| ≤ 2·105), consisting of uppercase and lowercase English letters — the text written in the newspaper.

Here |a| means the length of the string a.

Output
Print two integers separated by a space:

the first number is the number of times Tanya shouts “YAY!” while making the message,
the second number is the number of times Tanya says “WHOOPS” while making the message.
Examples

Input
AbC
DCbA
Output
3 0

Input
ABC
abc
Output
0 3

Input
abacaba
AbaCaBA
Output
3 4

把字母转化为int型数组,其值表示出现次数
a,b数组表示两个字符串中的小写字母
A, B数组表示两个字符串中的大写字母
aA, bB不区分大小写
当不区分大小写时能用到的字母个数就是有用字母数
能用于大小写一一对应的表示正确字母数 YAY
有用字母数 减 正确字母数就是 WHOOPS
可以看例子3 中 7个有用字母,3个大小可对应,其他4个大小不对应

#include<iostream>
#include<string>
int aA[30], a[30], A[30], i, j, k, bB[30], b[30], B[30], y, n, m;
using namespace std;
int main()
{
	string s1, s2;
	cin >> s1;
	cin >> s2;
	int l;
	l = s1.length();
	for (i = 0; i < l; i++)//s字符串处理
	{
		if (s1[i] >= 'a' && s1[i] <= 'z') a[s1[i] - 'a' + 1]++, aA[s1[i] - 'a' + 1]++;
		if (s1[i] >= 'A' && s1[i] <= 'Z') A[s1[i] - 'A' + 1]++, aA[s1[i] - 'A' + 1]++;
	}
	l = s2.length();
	for (i = 0; i < l; i++)//t字符串处理
	{
		if (s2[i] >= 'a' && s2[i] <= 'z') b[s2[i] - 'a' + 1]++, bB[s2[i] - 'a' + 1]++;
		if (s2[i] >= 'A' && s2[i] <= 'Z') B[s2[i] - 'A' + 1]++, bB[s2[i] - 'A' + 1]++;
	}
	for (i = 1; i <= 26; i++)//计算y正确字母数,n有用字母数
	{
		y += a[i] > b[i] ? b[i] : a[i];//对于任意一个字母应该取s和t中出现次数少的
		y += A[i] > B[i] ? B[i] : A[i];
		n += aA[i] > bB[i] ? bB[i] : aA[i];
	}
	m = n - y;//m表示WHOOPS次数
	cout << y << ' ' << m;
}
2025浏览器指纹伪装终极指南:Playwright修改WebGL+时区+分辨率,小红书爬1000条零验证 2025年小红书的反爬已经进入“多维校验”时代,单纯修改某一个指纹维度已失效。本文方案的核心是“让所有特征都一致且合理”——WebGL+Canvas+时区+分辨率+UA+行为,形成一个完整的“真实用户画像”,让小红书的反爬系统无法区分是爬虫还是真人。这套方案不仅适用于小红书,也可迁移到知乎、抖音、跨境电商等其他高反爬平台,只需替换对应的指纹库和数据提取逻辑。记住:指纹伪装的本质不是“欺骗”,而是“模拟真实”,把每个细节都做到和人类一致,自然就能实现“零验证”爬取。 阅读详情

相关推荐

深度学习|卷积神经网络

介绍卷积神经网络基本理论,包括卷积层、池化层和全连接层,并阐述LeNet卷积神经网络的构建过程。

weixin_58243219的博客 5727

Codeforces Round #293 (Div. 2) -- B. Tanya and Postcard

B. Tanya and Postcard time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little Tanya decided to present her d

Never say never 1014

Xilinx实战-深入AXI UART Lite IP核的配置与调试

本文详细介绍了Xilinx FPGA中AXI UART Lite IP核的配置与调试方法,包括Vivado环境下的IP核设置、关键参数优化、寄存器操作及常见问题排查。通过实战案例和代码示例,帮助开发者快速掌握AXI接口的串口通信技术,提升嵌入式系统开发效率。

weixin_29189377的博客 228

518B - Tanya and Postcard【哎还是string】

B. Tanya and Postcard time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little Tanya decided to present her dad a postc

章鱼小丸子 737

element的el-cascader组件动态加载,以及报错处理问题

Blocked aria-hidden on an element because its descendant retained focus. The focus must not be hidden from assistive technology users. 报错处理

weixin_56527169的博客 1264

Triton server的部署、构建、backend插件机制代码梳理、模型加载、自定义C++backend流程

Triton inference server的部署、构建、backend机制代码详细梳理、模型加载过程、自定义C++backend流程.

C/C++、嵌入式开发、深度学习算法、模型部署与推理优化 473

Codeforces Round #293 (Div. 2)

http://codeforces.com/contest/518/problem/A题解:http://fengweiding.blog.163.com/blog/static/23005412120151285140331/http://codeforces.com/contest/518/problem/BB. Tanya and Postcardtime limit per test2 s

chaideyipi 462

商品标签识别系统:基于YOLO系列的深度学习实现

随着零售行业的快速发展和自动化需求的增长,商品标签识别技术变得越来越重要。本文详细介绍了一个完整的商品标签识别系统,该系统基于YOLO系列目标检测算法(包括YOLOv5、YOLOv8和YOLOv10),采用PySide6构建用户界面,并提供完整的训练代码和数据集处理方案。该系统能够准确识别商品标签中的关键信息,如价格、条形码、生产日期等,为零售自动化、库存管理和智能结算提供技术支持。

YOLO 349

Codeforces Round #293 (Div. 2) 总结

A. Vitaly and Strings time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vitaly is a diligent student who never

小马的博客 531

ARM功耗管理之功耗状态及功耗模式

思考:功耗状态?功耗模式?Core&Cluster&Device&SoC如何映射?

AI-安全-功耗 784

使用Python爬虫抓取公共交通网站的时刻表

Python爬虫是一种通过自动化方式从网页中抓取数据的程序。爬虫通过模拟用户请求,获取网站的HTML页面内容,并通过解析这些HTML内容,提取出我们需要的信息。requests:用于向网站发送HTTP请求并获取响应。:用于解析HTML文档,提取数据。Selenium:用于处理动态加载的网页,模拟浏览器操作。pandas:用于数据处理和分析,方便存储和操作抓取到的数据。本文介绍了如何使用Python爬虫抓取公共交通网站的时刻表,并提取其中的关键信息。我们使用了requestsSelenium和。

2201_76125261的博客 1119

codeforces 518B. Tanya and Postcard

B. Tanya and Postcard time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little Tanya decided to present her...

weixin_30407099的博客 195

【Unity URP渲染管线下Shader的自定义物体半透明和投影半透明效果_半透明案例分享】

Unity Shader Graph URP渲染管线下的自定义半透明效果_半透明案例分享

暴走约伯的博客 3295

CodeForces 518B Tanya and Postcard

开始想着找到YAY的次数,用第一个字符串的长度减去它,就是剩的另一个结果。呃,显然这想法是错的。 the letter in the given position has only the correct value but it is in the wrong case, then the girl says "WHOOPS". 这才是第二个数据的正确求法。 #include #inclu

Kim0403的博客 525

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

codeforces 518B Tanya and Postcard

题目链接:点击打开链接 题目大意是给一个模板串a,以及另一个长度大于模板串的串b,两个字符集均为大小写英文字母。从b中选出字符构造串c使得c尽量与模板串a相同,优先让a和c相同位置上的字符字母和大小写均相同,如果无法大小写相同,尽量让字母相同。输出c和a中二者都相同和只有字母相同的数量。 此处需要注意,为了满足优先级,必须先对高优先级处理,全部处理完以后再对低优先级处理...(就wa在这里..

Green_Days 512

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

codeforces 518B Tanya and Postcard

题意: 。。。 思路: 错得太sb了 = = ,,放这里作为提醒吧。。 遍历容器的时候,如果使用c++11的auto,like map<int, int> ma; for (auto it:ma); it 是拷贝出来的, 修改它对容器不产生影响。。。

slowlight93的专栏 662

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

B. Tanya and Postcard

time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little Tanya decided to present her dad a postcard on his Birthd

无知的我 1333

CF 518B(Tanya and Postcard-计数统计)

B. Tanya and Postcard time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little Tanya decided to present her d

nike0good |Oier&ACMer | 熟能生巧 1443

CodeForces 518B. Tanya and Postcard

B. Tanya and Postcard time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little Tanya decided to present her dad a pos...

weixin_34418883的博客 158

CodeForces - 518B Tanya and Postcard(水题)

题意: 字母相同,且大小写相同叫一次”YAY” 字母相同,大小写不同叫一次”WHOOP” 输出 最大YAY的个数,和最大YAY的个数的情况下,WHOOP的个数。 解析: 将用过的字符串标记一下,最后进行统计,详见代码。 AC代码:#include <cstdio> #include <cstring> #include <algorithm> #include <cma

小G的ACM之路 1005

CodeForces 518B Tanya and Postcard (题意,水题)

点击打开链接 题意分析:题目读得有点晕,看了看网上的题解,其实不难。第一种情况判断两行字符串有多少字母是相同的,                     将每个字母相同的个数加起来再输出。第二种情况是求两行字符串有多少字符值相同但大小写不同。                     注意再统计完第一种情况后要将一样的字母减去才能够去统计第二种情况。 #include #include

smwqd_yehua_cx的博客 499

Codeforces Round #293 (Div. 2) B. Tanya and Postcard

B. Tanya and Postcard time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little Tanya decided to present her d

sunnykema的专栏 411

CodeForces 518B Tanya and Postcard 计数

先来错误代码, Wrong answer test 8: #include #include #include #include #include using namespace std; const int maxn = 200000 + 24; char s[maxn], t[maxn], ans[maxn]; map mp; int main() { scanf("%s%s",

JalexDooo的博客 503

codeforces 518B. Tanya and Postcard 解题报告

题目链接:http://codeforces.com/problemset/problem/518/B 题目意思:给出字符串 s 和 t,如果 t 中有跟 s 完全相同的字母,数量等于或者多过 s,就将 s 这个数量加到 YAY! 的答案里,少于的话就加t 中有的数量;如果 t 中有跟 s 相同的字母但是大小写不对应(例如A-a,z-Z),就加到 WHOOPS 的答案里。   举个例子就很容...

weixin_30478923的博客 177

Codeforces Round #293 (Div. 2) B. Tanya and Postcard 水题

B. Tanya and Postcard time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little Tanya decided to present her dad a pos...

weixin_34279579的博客 181
上一篇: Palindrome Dance
下一篇: Two Buttons
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值