A1084
输入:只能输入A-Z(不区分大小写),0-9和下划线;
第一行输入应输入字符串,第二行输入实际输入字符串。
输出:按大写输出缺少的字符,每个字符输出一次。
注意:
1、由于不区分大小写,则需要将小写字母识别为大写字母;
2、保证每个字符只出现一次。
思路:
1、将所有的字母都转化为大写字母;
2、挨个枚举第一个字符串,如果在第二个字符串中没有出现,且HashTable数组为false,则输出,HashTable值改为true。
#include<cstdio>
#include<cstring>
int main(){
char str1[],str2[];
bool HashTable[]={false}; //标记字符是否被输出,所有字符的ASCII码不会超过128
scanf("%s",str1);
scanf("%s",str2);
int len1=strlen(str1);
int len2=strlen(str2);
for(int i=;i<len1;i++){//枚举第一个字符串的每个字符
int j;
char c1,c2;
for(j=;j<len2;j++){//枚举第二个字符串的每一个字符
c1=str1[i];
c2=str2[j];
if(c1>='a'&&c1<='z') c1-=;
if(c2>='a'&&c2<='z') c2-=;
if(c1==c2) break;
}
if(j==len2&&HashTable[c1]==false){
printf("%c",c1);
HashTable[c1]=true;//c1为该字符所对应的ASCII码
}
}
return ;
}
A1084的更多相关文章
- 【清橙A1084】【FFT】快速傅里叶变换
问题描述 离散傅立叶变换在信号处理中扮演者重要的角色.利用傅立叶变换,可以实现信号在时域和频域之间的转换. 对于一个给定的长度为n=2m (m为整数) 的复数序列X0, X1, …, Xn-1,离散傅 ...
- A1084. Broken Keyboard
On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters ...
- PAT甲级——A1084 Broken Keyboard
On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters ...
- 1084 Broken Keyboard (20 分)
1084 Broken Keyboard (20 分) On a broken keyboard, some of the keys are worn out. So when you type so ...
- PAT_A1084#Broken Keyboard
Source: PAT A1084 Broken Keyboard (20 分) Description: On a broken keyboard, some of the keys are wor ...
- PAT甲级题解分类byZlc
专题一 字符串处理 A1001 Format(20) #include<cstdio> int main () { ]; int a,b,sum; scanf ("%d %d& ...
随机推荐
- CSS3 选择器用法小结
表单选择器: /*:enabled 可用的 :disabled 被禁用的 :focus 获取了焦点的 多用在表单元素上*/ input:enabled {...} input:disabled {.. ...
- Angular1.x DirtyChecking(脏值检查) $watch, $apply, $digest
Dirty Checking (脏值检查) Digest cycle and $scope Digest cycle and $scope First and foremost, AngularJS ...
- Django 模板继承extend 标签include block
# block 站网页位置# includ 导入网页标签# extends 导入网页模板 # common_js.html <script src="/static/plugins/j ...
- git下配置github sshkey
教程看这里 http://xiaxveliang.blog.163.com/blog/static/29708034201341244759225/
- zabbix使用问题
1中文乱码 https://www.linuxidc.com/Linux/2017-08/146162.htm 软件 说明 备注 zabbix 3.4.7 操作系统 Centos7 问题描述:图表内容 ...
- springboot学习入门之一---基本了解
1springboot基本了解 1.1概述 Spring Boot不是一门新技术,本质上就是spring. 特性: 1) 零配置(或很少配置) 2) 四个核心:(ASCA) 3.1)自动配置:spri ...
- 将虚拟网络连接到 ExpressRoute 线路
本文通过使用 Resource Manager 部署模型和 Azure 门户,帮助将虚拟网络 (VNets) 链接到 Azure ExpressRoute 线路. 虚拟网络可以在同一个订阅中,也可以属 ...
- Common administrative commands in Red Hat Enterprise Linux 5, 6, and 7
https://access.redhat.com/articles/1189123 Common administrative commands in Red Hat Enterprise Linu ...
- 《C++ Primer Plus》读书笔记之十—类和动态内存分配
第12章 类和动态内存分配 1.不能在类声明中初始化静态成员变量,这是因为声明描述了如何分配内存,但并不分配内存.可以在类声明之外使用单独的语句进行初始化,这是因为静态类成员是单独存储的,而不是对象的 ...
- 装office系统软件
在电脑里搜索 SW_DVD5_Office_Professional_Plus_2010w_SP1_64Bit_ChnSimp_CORE_MLF_X17-76742 如果已经安装过了,有错误,直接进行 ...