A1050】的更多相关文章

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 Sp…
输入两个字符串,将第一个字符串中包含的第二个字符串的字符去掉(包括空格),然后输出. gets()不能用了,我混搭了string和length(),不用纠结长度还是很好的. 第二个字符串所在HashTable数组对应位置如果不等于0,则清零.输出非零位置对应ch1的字符. 书上的代码更简洁一些,但是我尽力了orz. #include<cstdio> #include<iostream> #include<string.h> using namespace std; st…
一.技术总结 这个是使用了一个bool类型的数组来判断该字符是否应该被输出. 然后就是如果在str2中出现那么就判断为false,被消除不被输出. 遍历str1如果字符位true则输出该字符. 还有需要注意的是memset函数是在头文件#include"cstring"中. 二.参考代码: #include<iostream> #include<cstring> using namespace std; bool hashTable[256]; int main…
Given two strings S​1​​ and S​2​​, S=S​1​​−S​2​​ is defined to be the remaining string after taking all the characters in S​2​​ from S​1​​. Your task is simply to calculate S​1​​−S​2​​ for any given strings. However, it might not be that simple to do…
1050 String Subtraction (20 分) Given two strings S​1​​ and S​2​​, S=S​1​​−S​2​​ is defined to be the remaining string after taking all the characters in S​2​​from S​1​​. Your task is simply to calculate S​1​​−S​2​​ for any given strings. However, it…
Source: PAT A1050 String Subtraction (20 分) Description: Given two strings S​1​​ and S​2​​, S=S​1​​−S​2​​ is defined to be the remaining string after taking all the characters in S​2​​ from S​1​​. Your task is simply to calculate S​1​​−S​2​​ for any…
专题一  字符串处理 A1001 Format(20) #include<cstdio> int main () { ]; int a,b,sum; scanf ("%d %d",&a,&b); sum=a+b; ) { printf ("-"); sum=-sum; } ; ) { s[top++]=; } ) { s[top++]=sum%; sum/=; } ;i>=;i--) { printf ("%d"…