![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
字符串处理
ethannotlazy
这个作者很懒,什么都没留下…
展开
-
7-1 Good in C (20分)
7-1 Good in C (20分) When your interviewer asks you to write “Hello World” using C, can you do as the following figure shows? Input Specification: Each input file contains one test case. For each case, the first part gives the 26 capital English letters A-原创 2020-07-24 23:04:24 · 154 阅读 · 0 评论 -
1073 Scientific Notation (20分)
#include<string> #include<math.h> #include<iostream> using namespace std; int main() { string s; cin >> s; int indexOfE = s.find('E'); string baseNumber = s.substr(1, indexOfE - 1); int exp = stoi(s.substr(indexOfE + 1)); int原创 2020-05-13 00:20:29 · 131 阅读 · 0 评论 -
1001 A+B Format (20分)
两个数字都不超过int类型的范围,直接相加。 然后将结果转换为字符串,每隔三个数字插入一个逗号,注意判断有负号的情况。 #include<iostream> #include<string> using namespace std; int main() { int a, b; cin >> a >> b; int sum = a + b; ...原创 2020-02-28 22:29:08 · 108 阅读 · 0 评论 -
1108 Finding Average (20分)
xx.也是合法数字… #include<iostream> #include<string> #include<cctype> #include<cmath> using namespace std; int main() { int n; cin >> n; double sum = 0; int count = 0; fo...原创 2020-01-30 15:22:35 · 88 阅读 · 0 评论 -
1100 Mars Numbers (20分)
#include<string> #include<iostream> #include<cctype> #include<sstream> using namespace std; string higher[] = {"####", "tam", "hel", "maa", "huh", "tou", "kes", "hei", "elo", ...原创 2020-01-23 16:57:01 · 116 阅读 · 0 评论 -
1060 Are They Equal (25分)
这题的关键是小数点的处理,为了方便转换,可以将小数点去掉 为了确定化为标准形式应保留哪位,应该先找到第一个非零位 可以用stringstream将数字转换为字符串,需要包含sstream #include<string> #include<iostream> #include<sstream> using namespace std; string ge...原创 2020-01-11 23:04:36 · 114 阅读 · 0 评论 -
1071 Speech Patterns (25分)
#include<string> #include<cstring> #include<iostream> #include<cctype> #include<unordered_map> #include<algorithm> using namespace std; unordered_map<string, in...原创 2020-01-15 12:59:08 · 103 阅读 · 0 评论 -
1082 Read Number in Chinese (25分)
特别注意零的处理: #include<string> #include<iostream> using namespace std; string titles[] = { "Yi", "Qian", "Bai", "Shi", "Wan", "Qian", "Bai", "Shi", ""}; string num[] = { "ling", "yi", "er", ...原创 2020-01-18 10:23:07 · 102 阅读 · 0 评论