PAT (Advanced Level) 1092. To Buy or Not to Buy (20)
简单题。
#include<cstdio>
#include<cstring> const int maxn=1e5+;
char s1[maxn],s2[maxn];
int cnt[];
int tot[]; int main()
{
scanf("%s",s1);
scanf("%s",s2); memset(cnt,,sizeof cnt);
memset(tot,,sizeof tot); for(int i=;s1[i];i++) cnt[s1[i]]++;
for(int i=;s2[i];i++) tot[s2[i]]++; bool flag=;
int ans=; for(int i=;i<;i++)
{
if(cnt[i]<tot[i]){
flag=;
ans=ans+tot[i]-cnt[i];
}
} if(flag==) printf("No %d\n",ans);
else printf("Yes %d\n",strlen(s1)-strlen(s2));
return ;
}
PAT (Advanced Level) 1092. To Buy or Not to Buy (20)的更多相关文章
- PAT (Advanced Level) Practice 1011 World Cup Betting (20 分) 凌宸1642
PAT (Advanced Level) Practice 1011 World Cup Betting (20 分) 凌宸1642 题目描述: With the 2010 FIFA World Cu ...
- PAT (Advanced Level) Practice(更新中)
Source: PAT (Advanced Level) Practice Reference: [1]胡凡,曾磊.算法笔记[M].机械工业出版社.2016.7 Outline: 基础数据结构: 线性 ...
- PAT (Advanced Level) Practice 1001-1005
PAT (Advanced Level) Practice 1001-1005 PAT 计算机程序设计能力考试 甲级 练习题 题库:PTA拼题A官网 背景 这是浙大背景的一个计算机考试 刷刷题练练手 ...
- PAT (Advanced Level) Practice 1046 Shortest Distance (20 分) 凌宸1642
PAT (Advanced Level) Practice 1046 Shortest Distance (20 分) 凌宸1642 题目描述: The task is really simple: ...
- PAT (Advanced Level) Practice 1042 Shuffling Machine (20 分) 凌宸1642
PAT (Advanced Level) Practice 1042 Shuffling Machine (20 分) 凌宸1642 题目描述: Shuffling is a procedure us ...
- PAT (Advanced Level) Practice 1041 Be Unique (20 分) 凌宸1642
PAT (Advanced Level) Practice 1041 Be Unique (20 分) 凌宸1642 题目描述: Being unique is so important to peo ...
- PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642
PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642 题目描述: To prepare for PAT, the judge someti ...
- PAT (Advanced Level) Practice 1031 Hello World for U (20 分) 凌宸1642
PAT (Advanced Level) Practice 1031 Hello World for U (20 分) 凌宸1642 题目描述: Given any string of N (≥5) ...
- PAT (Advanced Level) Practice 1027 Colors in Mars (20 分) 凌宸1642
PAT (Advanced Level) Practice 1027 Colors in Mars (20 分) 凌宸1642 题目描述: People in Mars represent the c ...
随机推荐
- win7系统,apache2.2下添加PHP5的配置详解
首先要说apache(服务器). php(开发语言). mysql(数据库) 之间的关系. Apache:为系统提供了Web服务支持,网站:http://www.apache.org/ PHP:为系统 ...
- recursion 递归以及递归的缺点
递归定义的算法有两部分: 递归基:直接定义最简单情况下的函数值: 递归步:通过较为简单情况下的函数值定义一般情况下的函数值. 应用条件与准则: (1)问题具有某种可借用的类同自身的子问题描述的性质: ...
- Django:之不得不说的web框架们
python的web框架 Bottle Bpttle是一个快速.简洁.轻量级的基于WSIG的微型web框架,此框架只有一个.py文件,除了python的标准库外,其不依赖任何其它模块. pip ins ...
- how to use tar?
In UNIX, tar is the most useful tool to compress files (just like zip in Windows.) To compress, inpu ...
- contact form
use the existing service: http://www.foxyform.com/
- js阻止浏览器默认事件
1.阻止浏览器的默认行为 function stopDefault(e) { //如果提供了事件对象,则这是一个非IE浏览器 if(e && e.preventDefault) { / ...
- 我眼中的C#3.0 摘自于网络:http://www.cnblogs.com/joinger/articles/1297237.html
每次有新技术发布时,我们总能感受到两种截然不同的情绪: 一种是恐惧和抵抗,伴随着这种情绪的还有诸如"C# 2.0用的挺好的,为什么要在C# 3.0搞到那么复杂?"或者"我 ...
- 关于项目刚才还能运行的,重启Myeclipse就不能运行(报错)的解决方法
这个是以为内存不足引起的,就是打开MyEclipse的时候,因为内存不足,没有加载完整的项目,这个时候需要重启电脑,即可解决问题.
- event小解
首先是一个小例子: <input type="text" onclick="a(event)"/> function a(event){ con ...
- UITabBarController相关之tabBar文字不显示
1.在用tabBarController管理控制器的时候,出现了下面的问题 对应的代码: JingHuaController *jinghuaVC = [[JingHuaController allo ...