02 2020 档案
摘要:1. substr() 方法使用 string substr (size_t pos = 0, size_t len = npos) const;pos: 截取初始位置(从头开始截取pos=0)len: 截取字符长度 1 // using substr 2 string fullName = "Sh
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要:1.stoi()、stof()、stod() 实现字符串转 int、float、double。 stoi -> string to integer stof -> string to float stod -> string to double 函数原型: int stoi (const strin
阅读全文
摘要: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] # 还
阅读全文
摘要:1. rstrip()方法,去掉字符串结尾空格 >>> name = "Sheep Core " >>> name.rstrip() 'Sheep Core' #已经去掉末尾空格 note: r 表示 right! 补充: 2. lstrip() 方法,去掉字符串开头空格 >>> name = "
阅读全文
摘要:// 2020-02-26 1. polynomials -- 多项式 2. exponents and coefficients -- 指数和系数 3. 1 decimal place -- 小数点后一位
阅读全文
摘要: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
阅读全文
摘要:1. 使用Scanner读取字符和字符串 3 /** 4 * Created by SheepCore on 2020-2-26 5 */ 7 public class Main { 8 public static void main(String[] args) { 9 Scanner scan
阅读全文
摘要:1. 关于C++头文件 C++的头文件一般是没有像C语言的 .h 这样的扩展后缀的,一般情况下C语言里面的头文件去掉 .h 然后在前面加个 c 就可以继续在C++文件中使用C语言头文件中的函数啦~比如: 1 #include <cmath> // 相当于C语言里面的#include <math.h>
阅读全文
摘要:1. 关于PAT如何高效刷题 先易后难,先新后旧,先简单后复杂 挑tag刷题,按分类刷题 多参照大神代码,学会取舍 可以适当从自己薄弱的Tag刷,增加信心 建议选择C++(推荐)、Java,不建议python(速度慢,占内存) 2. PAT 刷题如何记笔记 整理刷题过程中不会的英中文单词意思 善于记
阅读全文
摘要:1.Description: 2.Example: Input: -100000 9 Output: -999,991 3.Solutions: C Version: // // Created by SheepCore on 2020-02-23. // #include <stdio.h> #i
阅读全文

浙公网安备 33010602011771号