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 ...
随机推荐
- Windows server 2008搭建php运行环境
下载php组件包 首先到http://windows.php.net/download/下载你需要的php版本,这里我下载的是php5.3. 下面解压php组件 包到磁盘上. 安装Microsoft ...
- H5的新应用-拖到页面上的元素
-------------------------- <script type="text/javascript"> // ...
- RESTful架构3--开发实战
转自:REST服务开发实战 如果要说什么是REST的话,那最好先从Web(万维网)说起. 什么是Web呢?读者可以查看维基百科的词条(http://zh.wikipedia.org/zh-cn/Web ...
- LCA-倍增法(在线)O(nlogn)-O(logn)
1. DFS预处理出所有节点的深度和父节点 inline void dfs(int u) { int i; ;i=next[i]) { if (!deep[to[i]]) { deep[to[i]] ...
- servlet第2讲(下集)----通过HttpServlet实现一个用户登录网站(继承HttpServlet)
1.计划框架 2.先建立Login的servlet (1)建立Login,编写代码,进行编译 (2)配置web.xml (3)重新加载,并且验证 (4)解决乱码问题 (5)再次加载,然后验证 ...
- Postgres数据库在Linux中的I/O优化
I/O 优化1 打开 noatime方法: 修改 /etc/fstab2 调整预读方法: 查看 sudo blockdev --getra /dev/sda 设置 sudo blockdev --se ...
- 确定当前Python环境中的site-packages目录位置
引入“搜索路径”这个概念是因为在使用import语句时,当解释器遇到import语句,如果模块在当前的搜索路径就会被导入. 搜索路径是一个解释器会先进行搜索的所有目录的列表. 那么python如何添加 ...
- Qt学习
博客 一去丶二三里的博客 http://blog.sina.com.cn/s/articlelist_2801495241_0_4.html
- Java学习笔记之自定义异常
1.自定义异常类: /** * 自定义异常,只要继承继承Exception类或其子类即可 * @author Administrator * */ public class FileException ...
- word project 2010破解
1.用这个工具提示失败: failed to inject memory Failed to inject memory!解决方法 浏览:6545 | 更新:2013-07-15 15:52 在激活o ...