1050 String Subtraction (20 分)_10行代码AC
立志用最少的代码做最高效的表达
PAT甲级最优题解——>传送门
Given two strings S1 and S2, S=S1−S2 is defined to be the remaining string after taking all the characters in S2 from S1. Your task is simply to calculate S1−S2 for any given strings. However, it might not be that simple to do it fast.
Input Specification:
Each input file contains one test case. Each case consists of two lines which gives S1 and S2, respectively. The string lengths of both strings are no more than 104. It is guaranteed that all the characters are visible ASCII codes and white space, and a new line character signals the end of a string.
Output Specification:
For each test case, print S1−S2 in one line.
Sample Input:
They are students.
aeiouSample Output:
Thy r stdnts.
查询表算法。
#include<bits/stdc++.h>
using namespace std;
int a[300];
int main() {string s1, s2; getline(cin, s1); getline(cin, s2);for(auto i : s2) a[i]++;for(auto i : s1) if(a[i] == 0) cout << i;return 0;
}
耗时:
求赞哦~ (✪ω✪)
1050 String Subtraction (20 分)_10行代码AC相关推荐
- 【简便代码】1063 计算谱半径 (20分)_10行代码AC
立志用更少的代码做更高效的表达 Pat乙级最优化代码+题解+分析汇总-->传送门 在数学中,矩阵的"谱半径"是指其特征值的模集合的上确界.换言之,对于给定的 n 个复数空间的 ...
- PAT甲级 -- 1050 String Subtraction (20 分)
Given two strings S1 and S2, S=S1−S2 is defined to be the remaining string after taking ...
- 1081 Rational Sum (20 分)_22行代码AC
立志用最少的代码做最高效的表达 PAT甲级最优题解-->传送门 Given N rational numbers in the form numerator/denominator, you a ...
- 【PAT甲级 删除字符串中的指定字符】1050 String Subtraction (20 分) C++
题目 删除字符串中的另一个字符串包含的所有字符. 可以通过判断两个字符串是否为空,来稍微优化一下运行速度 题解C++ #include<iostream> #include<stri ...
- C++ PAT甲级 1050 String Subtraction (20分)
Given two strings S1 and S2, S=S1−S2is defined to be the remaining string aftertaking all the cha ...
- 【PAT (Advanced Level) Practice】1050 String Subtraction (20 分)
C/C++中整型数组的下标类型不一定为整型,C C++语言下数组性质与散列有些类似,即散列中的键值对:下标即为关键码,关键码通过散列函数映射得到元素即为值 下标可以为整型,也可以为字符型,简单案例如下 ...
- 1094 谷歌的招聘 (20分)_25行代码AC
立志用最少的代码做更高效的表达 PAT乙级最优题解-->传送门 2004 年 7 月,谷歌在硅谷的 101 号公路边竖立了一块巨大的广告牌(如下图)用于招聘.内容超级简单,就是一个以 .com ...
- 【测试点分析】1067 试密码 (20分)_20行代码AC
立志用更少的代码做更高效的表达 Pat乙级最优化代码+题解+分析汇总-->传送门 当你试图登录某个系统却忘了密码时,系统一般只会允许你尝试有限多次,当超出允许次数时,账号就会被锁死.本题就请你实 ...
- 1073 多选题常见计分法 (20 分)_66行代码AC
立志用最少的代码做最高效的表达 PAT乙级最优题解-->传送门 批改多选题是比较麻烦的事情,有很多不同的计分方法.有一种最常见的计分方法是:如果考生选择了部分正确选项,并且没有选择任何错误选项, ...
最新文章
- xshell virt-manager RuntimeError: could not open display
- 使用docker搭建一个elasticsearch(5.4)的基础环境
- 【408预推免复习】操作系统之虚拟存储器
- 避免重蹈欧美“超级电厂”覆辙 瑞星全力保障国内电力行业信息安全
- boost::smart_ptr模块collector相关的测试程序
- 中职计算机专业英语说课稿,高职高专英语说课稿
- c++ 删除二叉树的子树_平衡二叉树
- Linux文件锁学习-flock, lockf, fcntl
- MATLAB信号处理之常用信号的表示(2)
- html 图片 按钮,css按钮背景图片如何实现?(代码实例)
- CentOS7.0下安装PHP5.6.30服务
- VM下安装ubuntu教程
- 为什么要使用Memcached
- ECSHOP问题总结
- Vue element table按钮实现当行expand详情(右箭头)
- 孩子给产品经理的一堂课
- linux监控工具gotop
- xargs -i参数详解
- Spring data报错:Inferred type 'S' for type parameter 'S' is not within its bound;
- python流水灯简单程序_简单流水灯的实现程序