
字符串
土方
这个作者很懒,什么都没留下…
展开
-
hdu1013-字符相加
1013 输出的数必须是一位数,24 = 2+4 =639 = 3+9 =12,12 = 1+2 =3 所以输出3--------------------------------------------------------------------------------------------------------------------------------------原创 2016-08-05 15:53:08 · 536 阅读 · 0 评论 -
hdu1402-大数相乘
1402。。又超时了 QAQ#include #include using namespace std; string pre(string &a) { int i = 0; if (a[0]!='0') return a; while (a[i] == '0') i++; a = a.substr(i,a.length()-1);原创 2016-08-02 20:16:05 · 372 阅读 · 0 评论 -
hdu1002-大数相加
1002#include #include using namespace std; string pre(string &a){ int i = 0; if (a[0]!='0') return a; while (a[i] == '0') i++; a = a.substr(i,a.length()-1); //删除前面的0,如00原创 2016-08-02 12:26:01 · 283 阅读 · 0 评论 -
hdu1251-字符前缀查找问题 map容器
1251#include<iostream>#include<string>#include<map>using namespace std;int main(){ string str,str1; map<string, int> map1; while(getline(cin, str)&& str.length() !=0) { for(int i = 1; i != str.size()+1; i++)原创 2016-07-26 21:28:00 · 446 阅读 · 0 评论 -
hdu1113-字符查找问题 map容器
1113#include #include #include #include using namespace std;int main(){ map map1; map ::iterator it; string str1,str,str2; while (cin>>str && str.compare("XXXXXX")!=0) { str1 = str原创 2016-07-26 17:21:37 · 353 阅读 · 0 评论 -
hdu1062-字符串翻转问题 reverse()
1062Sample Input3olleh !dlrowm'I morf .udhI ekil .mca Sample Outputhello world!I'm from hdu.I like acm.HintRemember to use getchar() to read '\n' after the interger T,原创 2016-07-21 17:36:31 · 437 阅读 · 0 评论 -
hdu1860-统计字符出现次数问题 string.find()
1860Sample Input I THIS IS A TEST i ng this is a long test string #Sample Output I 2 i 3 5 n 2 g 2 注:第2个测试用例中,空格也是被统计的字符之一。 string 类提供了 6 种查找函数,每种函数以不同形式的 find 命名。 这些操作全都返回 string::siz原创 2016-07-21 09:50:41 · 987 阅读 · 0 评论 -
C++STL之string详讲
在学习c++STL中的string,在这里做个笔记,以供自己以后翻阅和初学者参考。 1:string对象的定义和初始化以及读写 string s1; 默认构造函数,s1为空串 string s2(s1); 将s2初始化为s1的一个副本 string s3(“valuee”); 将s3初始化一个字符串面值副本 string s4(n,’c’); 将s4 初始化为字符’c转载 2016-07-19 16:23:32 · 411 阅读 · 0 评论 -
hdu1020-统计字符出现次数问题
Sample Input 2 ABC ABBCCCSample Output ABC A2B3C 1020 出错点1: 题目只对紧挨在一起的字符统计(相当于简写),并不是所有输入的字符。如 AABAAA 输出为 2AB3A 非 5AB 出错点2: for(i = 0;i#include <iostream> #include<string>using nam原创 2016-07-19 15:32:43 · 279 阅读 · 0 评论