1092. To Buy or Not to Buy (20)
来源:互联网 发布:云计算工程师好干吗 编辑:程序博客网 时间:2024/06/15 22:49
#include<cstdio>#include<cstring>int main(){ char str1[1010],str2[1010]; int flag[256]={0},len1,len2,i; int more=0,less=0,temp=0; scanf("%s%s",str1,str2); len1 = strlen(str1); len2 = strlen(str2); for(i=0; i<len1; i++) { flag[str1[i]]++; } for(i=0; i<len2; i++) { flag[str2[i]]--; } for(i=0; i<256; i++) { if(flag[i]<0) //不能买 temp = 1; if(flag[i]>0 && temp==0) more += flag[i]; if(flag[i]<0 && temp==1) less += -1 * flag[i]; } if(temp==0) printf("Yes %d",more); else printf("No %d",less); return 0;}
0 0
- 1092.To Buy or Not to Buy
- 1092. To Buy or Not to Buy
- 1092. To Buy or Not to Buy
- 1092. To Buy or Not to Buy
- 1092. To Buy or Not to Buy
- 1092. To Buy or Not to Buy
- 1092. To Buy or Not to Buy (20)
- PAT A 1092. To Buy or Not to Buy (20)
- 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)
- 1092. To Buy or Not to Buy (20)
- 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)
- 1092. To Buy or Not to Buy (20)
- PAT 1092. To Buy or Not to Buy (20)
- 1092. To Buy or Not to Buy (20)
- 冒泡排序
- iptable使用笔记
- 1090. Highest Price in Supply Chain (25)
- Python中的新奇玩意
- POSIX(Portable Operating System Interface )信号处理
- 1092. To Buy or Not to Buy (20)
- 1.3props与state
- Windows每月更新补丁离线安装包下载
- 仙人掌相关问题的处理方法(未完待续)
- 1094. The Largest Generation (25)
- Gson的使用
- Python的基础性东西学习
- Linux开发基础:Shell编程入门(一)
- int与string的相互转换