上一页 1 ··· 4 5 6 7 8 9 10 11 下一页
摘要: 1.Description: Now you are asked to solve a more general problem: find the first K-digit prime in consecutive digits of any given L-digit number. 2.Ex 阅读全文
posted @ 2020-03-01 19:51 SheepCore 阅读(210) 评论(0) 推荐(0) 编辑
摘要: 1.Description: The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which 阅读全文
posted @ 2020-03-01 19:41 SheepCore 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 1. substr() 方法使用 string substr (size_t pos = 0, size_t len = npos) const;pos: 截取初始位置(从头开始截取pos=0)len: 截取字符长度 1 // using substr 2 string fullName = "Sh 阅读全文
posted @ 2020-02-28 14:21 SheepCore 阅读(3230) 评论(0) 推荐(0) 编辑
摘要: 1. 使用string()构造函数方法 1 //method 1: the constructor of string() 2 char c = 'F'; 3 string s = string(1, c); 4 cout << s ; 2. 使用stringstream字符流 1 //method 阅读全文
posted @ 2020-02-28 13:44 SheepCore 阅读(4219) 评论(0) 推荐(1) 编辑
摘要: 1.Description: 2.Example: Input: 12345 Output: one five 3.solutions: C Version: 1 #include <stdio.h> 2 #include <string.h> 3 #include <stdlib.h> 4 5 i 阅读全文
posted @ 2020-02-28 08:02 SheepCore 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 1.stoi()、stof()、stod() 实现字符串转 int、float、double。 stoi -> string to integer stof -> string to float stod -> string to double 函数原型: int stoi (const strin 阅读全文
posted @ 2020-02-27 14:23 SheepCore 阅读(1401) 评论(1) 推荐(0) 编辑
摘要: 1. 简单列表解析 假设我们需要创建一个列表为:[0,0,0,0,0,0, 0,0,0, 0](size=10) 显然这样写0很费劲。所以有一种叫做列表解析的东西可以快速生成: >>> [0 for i in range(10)] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # 还 阅读全文
posted @ 2020-02-26 23:23 SheepCore 阅读(1663) 评论(0) 推荐(0) 编辑
摘要: 1. rstrip()方法,去掉字符串结尾空格 >>> name = "Sheep Core " >>> name.rstrip() 'Sheep Core' #已经去掉末尾空格 note: r 表示 right! 补充: 2. lstrip() 方法,去掉字符串开头空格 >>> name = " 阅读全文
posted @ 2020-02-26 22:32 SheepCore 阅读(12811) 评论(0) 推荐(1) 编辑
摘要: // 2020-02-26 1. polynomials -- 多项式 2. exponents and coefficients -- 指数和系数 3. 1 decimal place -- 小数点后一位 阅读全文
posted @ 2020-02-26 21:58 SheepCore 阅读(319) 评论(0) 推荐(0) 编辑
摘要: 1.Description: 2.Example: Input:2 1 2.4 0 3.2 2 2 1.5 1 0.5output:3 2 1.5 1 2.9 0 3.2 3.Solutions: C++ Version: 1 #include<iostream> 2 #include<map> 3 阅读全文
posted @ 2020-02-26 21:45 SheepCore 阅读(202) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 下一页