1092. To Buy or Not to Buy (20)
来源:互联网 发布:最火的中文编程 编辑:程序博客网 时间:2024/05/01 14:37
#include <stdio.h>#include <string.h>using namespace std;int main(){ char ch[1001]; char ch1[1001]; gets(ch); gets(ch1); int index[101]; for(int i=0;i<101;i++) { index[i]=0; } for(int i=0;i<strlen(ch);i++) { if(ch[i]>='0'&&ch[i]<='9') index[ch[i]-'0']++; if(ch[i]>='a'&&ch[i]<='z') index[ch[i]-'a'+10]++; if(ch[i]>='A'&&ch[i]<='Z') index[ch[i]-'A'+40]++; } for(int i=0;i<strlen(ch1);i++) { if(ch1[i]>='0'&&ch1[i]<='9') index[ch1[i]-'0']--; if(ch1[i]>='a'&&ch1[i]<='z') index[ch1[i]-'a'+10]--; if(ch1[i]>='A'&&ch1[i]<='Z') index[ch1[i]-'A'+40]--; } int count=0; int count2=0; int flag=1; for(int i=0;i<101;i++) { if(index[i]>0) count+=index[i]; if(index[i]<0) { flag=0; count2-=index[i]; } } if(flag) printf("Yes %d",count); else printf("No %d",count2);}
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)
- cadence.封装1
- 多维数组作为函数参数的形式
- python学习笔记-(16)python中的函数对象
- (1166)HDU
- MySQL常用命令总结
- 1092. To Buy or Not to Buy (20)
- 实现网页中的搜索输入框效果 onfocuse onblur js 验证手机号 座机区号
- LeetCode : No9 Palindrome Number
- 重庆帅气交警遭众多女子围拍致交通拥堵
- 关于java路径的获取问题,保证部署(jar)到机器上正常运行
- jdk 1.7与Tomcat环境变量配置
- 扩展graphiclayer实现多城市天气情况的展示
- (1.1.17)编程基础之this指针的用法及介绍
- 黑马程序员 -- C语言 指针 其他类型