PAT 1092. To Buy or Not to Buy (20)
来源:互联网 发布:aws s3 上传文件 js 编辑:程序博客网 时间:2024/05/01 19:49
#include<stdio.h>#include<string.h>#include<map>#define SIZE 1005using namespace std;char sell[SIZE], want[SIZE];map<char, int>m;int main(){ freopen("1.in", "r", stdin); scanf("%s", sell); scanf("%s", want); int i; for (i = 0; i < strlen(want); i++) m[want[i]]++; for (i = 0; i < strlen(sell); i++) if (m[sell[i]]>0) m[sell[i]]--; map<char, int>::iterator it; int count = 0; for (it = m.begin(); it != m.end(); it++) if (it->second>0) count += it->second; if (count == 0) printf("Yes %d\n", strlen(sell) - strlen(want)); else printf("No %d\n", count); return 0;}
0 0
- PAT A 1092. To Buy or Not to Buy (20)
- PAT 1092. To Buy or Not to Buy (20)
- pat 1092. To Buy or Not to Buy (20)
- PAT 1092. To Buy or Not to Buy (20)
- 【PAT】1092. To Buy or Not to Buy (20)
- PAT 1092. To Buy or Not to Buy (20)
- PAT-A 1092. To Buy or Not to Buy (20)
- PAT-A-1092. To Buy or Not to Buy (20)
- Pat(A) 1092. To Buy or Not to Buy (20)
- PAT 1092. To Buy or Not to Buy
- PAT 1092. To Buy or Not to Buy(STL)
- PAT-A 1092. To Buy or Not to Buy
- PAT--1092. To Buy or Not to Buy
- 【PAT】1092. To Buy or Not to Buy
- pat 1092. To Buy or Not to Buy
- PAT A1092. To Buy or Not to Buy (20)
- PAT A1092. To Buy or Not to Buy (20)
- PAT A1092. To Buy or Not to Buy (20)
- FPGA100个值得注意的要点
- Eclipse 使用技巧
- 一天一段scala代码(十六)
- 黑马程序员--java面向对象的理解
- 简单的用栈实现后缀表达式
- PAT 1092. To Buy or Not to Buy (20)
- 从《编程之美》买票找零问题说起,娓娓道来卡特兰数——兼爬坑指南
- Java 标准类使用 Java.util.Scanner
- 1030. 完美数列(25)
- java编程和新基础
- 微信订阅号+新浪SAE
- Android-sharedUserId数据权限
- 2015蘑菇街实习生笔试题:A+B= M
- 散列