随笔分类 - 3.6字符串处理
摘要://坑点一,序号不存在,表示序号可能大于最大值,或者小于最小值。 //坑点二,输出转义字符\,用\\ 注意点: 动态二维数组,只能插入一维数组,不能直接通过语法v[i].push_back(str)实现粒度插入。 但是固定一边的二维数组,可以直接通过语法v[i].push_back(str)实现粒度
阅读全文
摘要:首先,因为输入的正整数的高位放在存储的低位,所以要对正整数进行逆置。 其次,因为给出的两个正整数的位数可能不一致,所以要处理成位数一致再进行运算。 #include<iostream> #include<algorithm> using namespace std; string hashtable
阅读全文
摘要:较水。 #include<iostream> using namespace std; int hashtable1[300] = {0},hashtable2[300]= {0}; int main() { string str1,str2; cin>>str1>>str2; for(int i
阅读全文
摘要:注意点: 一,下划线 _(代表空格),接收输入是真的空格,所以要用getline接收一行输入。 二,判断大写字母能否输出,必须同时上档键+和小写字母的键都未坏。 #include<iostream> #include<cctype> using namespace std; string str1,
阅读全文
摘要:注意点: 一,加权求和表示,每一位乘以该位的权值最后求和,只对前17位加权求和。 新学一招,整型到字符的hash。 string hashtable = "10X98765432"; #include<iostream> #include<cctype> using namespace std; s
阅读全文
摘要:水题。与B1093 字符串A+B 类似。 #include<iostream> #include<cctype> using namespace std; bool hashtable[300] = {false}; int main() { string str1,str2; cin>>str1>
阅读全文
摘要:题意不难理解,但是做起来比较麻烦。 用的string的erase(迭代器),find(字符串)返回pos和substr. 给出的数用str存放,如果是负数,就输出'-',否则不输出。然后用erase移除第一个符号,无论正负。 然后把str按照E划分成两个部分,前半部为a,后半部为e。 如果e < 0
阅读全文
摘要:水题。 #include"iostream" using namespace std; int hashtable[10] = {0}; int main() { string str; cin>>str; for(int i = 0; i < str.length(); ++i) hashtabl
阅读全文
摘要:题意有点不明不白。 注意点:字符间的比较是在同一下标进行的(不然测试点1,4过不了)。 #include"iostream" #include"cctype" using namespace std; string hashtable1[7] = {"MON ","TUE ","WED ","THU
阅读全文
摘要:水题。 STL:vector,string #include"iostream" #include"vector" using namespace std; int main() { vector<string> vs; string str; while(cin>>str) vs.push_bac
阅读全文
摘要:水题。 #include"iostream" using namespace std; string s[11] = {"ling","yi","er","san","si","wu","liu","qi","ba","jiu"}; int main() { int ans = 0; string
阅读全文

浙公网安备 33010602011771号