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 ...
随机推荐
- MFC中获取系统当前时间
1.使用CTime类 CString str; //获取系统时间 CTime tm; tm=CTime::GetCurrentTime(); str=tm.Format("现在时间是%Y年% ...
- JS进阶书籍
http://blog.csdn.net/bingqingsuimeng/article/details/40535291 本来想尝试每天回答或看已解决的3个问题来学习总结今天的知识点,看了下博文里面 ...
- MVC中用 BundleCollection 压缩CSS时图片路径问题
MVC中有个专门提供JS和CSS压缩的类,BundleCollection,其实这个类也可以在asp.net中用, 关于BundleCollection类的详细推荐个地址:http://www.cnb ...
- ffmpeg 录屏 screen capture recorder
ffmpeg在Linux下用X11grab进行屏幕录像,在Windows下用DirectShow滤镜 首先需要安装一个软件,screen capture recorder 编译好的下载地址是: htt ...
- 如何从Apache官网下载apache
apache服务器官网地址:http://httpd.apache.org/ linux版本下载比较容易,以windows版本,apache 2.4为例. 点击download 此处随便选一个提供商. ...
- WPF子窗体:ChildWindow
wpf的子窗体选择有很多种,如最常见的是项目新建窗体(Window)作为子窗体 ,或者新建wpf用户控件(UserControl).而其实利用Xceed.Wpf.Toolkit.dll 可以轻松布局如 ...
- Windsock套接字I/O模型学习 --- 第一章
1. I/O模型共有以下几种: 阻塞(blocking)模型 选择(select)模型 WSAAsyncSelect模型 WSAEventSelect模型 重叠(overlapped)模型 完成端口( ...
- Number Sequence HDU 1711 KMP 模板
题目大意:两个数组匹配,求子串首次出现的位置. 题目思路:数组长度,比较大,朴素算法的时间复杂度为 m*n超时.KMP的时间复杂度为m+n可行. #include<iostream> #i ...
- Jquery 控制元素 上 下 移动
<html> <head> <meta http-equiv="Content-Type" content="text/html; char ...
- C++调用C#之C# COM控件
C#做界面真的是比C++方便多了,所以尝试了一下,使用C++做核心功能(例如绘图),然后用C#来做节目(例如对话框),考虑到以后可能不能使用.net,使用DLL做一个隔离层,隔离C++和C#,方便以后 ...