IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> C++知识库 -> 【PAT】练习总结 -> 正文阅读

[C++知识库]【PAT】练习总结

笔记

  1. 设置存储hash的数组可以尽量设大一点。

  2. c++中map可随意访问、任意插入,index,vector不行。

  3. ASCII码共有128个,其中比较常见的ASCII码:

    1. 10 = ’\n‘
    2. 48~57: 0 ~ 9
    3. 65 ~ 90: ’A‘ ~ ’Z‘
    4. 97 ~ 122: ‘a’ ~ ‘z’
  4. C语言定义数组的方法:

    1. int a[] = {1, 2, 3}; // 不定长数组,长度由元素个数决定。
    2. int a[N];// 定长数组 。
    3. int *a;// 定义指针
  5. C语言往函数传数组的方法:

    1. int fuc(int *a, int size){int n = *(a + 0)}; // 传入指针和大小两个变量
    2. int fuc(int a[], int size){}; // 传入数组和大小两个变量
    3. int fuc(int a[10]){}; // 只传入数组一个变量
  6. C++中tolower()函数是把字符串都转化为小写字母,touppre()函数是把字符串都转化为大写字母。

  7. 判断某数是否为素数:

    bool isPrime(int n){
        if(n == 1)	return false;	// 要考虑数字1
        for(int i = 2; i <= sqrt(n); i++)	// 是i <= sqrt(n),而不是 i <= n / 2。
            if(n % i == 0)	return false;
        return true;
    }
    
  8. 使用sqrt()需要#include <cmath>

  9. 正向平方探测法,pos = (key + i * i)% Tsize (0 <= i < Tsize)

  10. getline(cin, str),这个函数可读入一整行的字符串(包括空格

  11. 在字符串中查找字符可用str.find(c),若没找到,会返回string::npos。所以判断字符串中有无字符可用if(s.find(c) != string::npos)

  12. 查找字符串a是否包含子串b,不是用strA.find(strB) > 0strA.find(strB) != string:npos

  13. 查找一串数字里是否存在某个数的问题一般用hash。

易错

  1. 为了与C兼容,在C中没有string类型,故用printf()输出string时,必须通过string类对象的成员函数c_str()把string对象转换成C中的字符串样式:

    string s = "123";
    printf("%s", s.c_str());
    
  2. 查找字符串a是否包含子串b,而strA.find(strB) != string:npos;判断字符串中有无字符可用if(s.find(c) != string::npos)

题目分类

类型题目刷题笔记
hash1154
hash1145
hash1134
hash1092 To Buy or Not to Buy (20 分)https://blog.csdn.net/SSibyl/article/details/115559781?spm=1001.2014.3001.5501
hash1084 Broken Keyboard (20 分)https://blog.csdn.net/SSibyl/article/details/115920266?spm=1001.2014.3001.5501
hash1078 Hashing (25 分)https://blog.csdn.net/SSibyl/article/details/116198964?spm=1001.2014.3001.5501
hash1050 String Subtraction (20 分)https://blog.csdn.net/SSibyl/article/details/116199564?spm=1001.2014.3001.5501
hash1048 Find Coins (25 分)https://blog.csdn.net/SSibyl/article/details/116210005?spm=1001.2014.3001.5501
hash1041 Be Unique (20 分)https://blog.csdn.net/SSibyl/article/details/116210571?spm=1001.2014.3001.5501
字符串1152 Google Recruitment (20 分)https://blog.csdn.net/SSibyl/article/details/116242675?spm=1001.2014.3001.5501
字符串1140 Look-and-say Sequence (20 分)https://blog.csdn.net/SSibyl/article/details/116243889?spm=1001.2014.3001.5501
字符串1108 Finding Average (20 分)https://blog.csdn.net/SSibyl/article/details/116352827?spm=1001.2014.3001.5501
字符串1082 Read Number in Chinese (25 分)https://blog.csdn.net/SSibyl/article/details/116357128?spm=1001.2014.3001.5501
字符串1077 Kuchiguse (20 分)https://blog.csdn.net/SSibyl/article/details/116358127?spm=1001.2014.3001.5501
字符串1073 Scientific Notation (20 分)https://blog.csdn.net/SSibyl/article/details/116428996?spm=1001.2014.3001.5501
字符串1061 Dating (20 分)https://blog.csdn.net/SSibyl/article/details/116536169?spm=1001.2014.3001.5501
字符串1035 Password (20 分)https://blog.csdn.net/SSibyl/article/details/116463362?spm=1001.2014.3001.5501
字符串5. 1005
字符串6. 1001
STL1153 Decode Registration Card of PAT (25分)https://blog.csdn.net/SSibyl/article/details/116497987?spm=1001.2014.3001.5501
STL1149 Dangerous Goods Packaging (25 分)https://blog.csdn.net/SSibyl/article/details/116543547?spm=1001.2014.3001.5501
STL1144 The Missing Number (20 分)https://blog.csdn.net/SSibyl/article/details/116545641?spm=1001.2014.3001.5501
STL4. 1141
STL1137. Final Grading (25)https://blog.csdn.net/SSibyl/article/details/116712638?spm=1001.2014.3001.5501
STL1129 Recommendation System (25 分)https://blog.csdn.net/SSibyl/article/details/116712459?spm=1001.2014.3001.5501
STL1124 Raffle for Weibo Followers (20 分)https://blog.csdn.net/SSibyl/article/details/116716031?spm=1001.2014.3001.5501
STL1120 Friend Numbers (20 分)https://blog.csdn.net/SSibyl/article/details/117200788?spm=1001.2014.3001.5501
STL1121 Damn Single (25 分)https://blog.csdn.net/SSibyl/article/details/116719546?spm=1001.2014.3001.5501
STL1112 Stucked Keyboard (20 分)https://blog.csdn.net/SSibyl/article/details/116800307?spm=1001.2014.3001.5501
STL1100 Mars Numbers (20 分)https://blog.csdn.net/SSibyl/article/details/116806960?spm=1001.2014.3001.5501
STL1. 1095(没做)
STL1071 Speech Patterns (25 分)https://blog.csdn.net/SSibyl/article/details/116895581?spm=1001.2014.3001.5501
STL1063 Set Similarity (25 分)https://blog.csdn.net/SSibyl/article/details/116897670?spm=1001.2014.3001.5501
STL1054 The Dominant Color (20 分)https://blog.csdn.net/SSibyl/article/details/116900037?spm=1001.2014.3001.5501
STL1047 Student List for Course (25 分)https://blog.csdn.net/SSibyl/article/details/117092103?spm=1001.2014.3001.5501
STL1039 Course List for Student (25 分)https://blog.csdn.net/SSibyl/article/details/117201164?spm=1001.2014.3001.5501
排序1. 1153
排序2. 1141
排序3. 1137
排序1125 Chain the Ropes (25 分)https://blog.csdn.net/SSibyl/article/details/117201592?spm=1001.2014.3001.5501
排序1113 Integer Set Partition (25 分)https://blog.csdn.net/SSibyl/article/details/117248636?spm=1001.2014.3001.5501
排序1101 Quick Sort (25 分)https://blog.csdn.net/SSibyl/article/details/117255502?spm=1001.2014.3001.5501
排序1083 List Grades (25 分)https://blog.csdn.net/SSibyl/article/details/117253941?spm=1001.2014.3001.5501
排序1080 Graduate Admission (30 分)https://blog.csdn.net/SSibyl/article/details/117373576?spm=1001.2014.3001.5501
排序1062 Talent and Virtue (25 分)https://blog.csdn.net/SSibyl/article/details/117464964?spm=1001.2014.3001.5501
模拟1002 A+B for Polynomials (25 分)https://blog.csdn.net/SSibyl/article/details/118694245?spm=1001.2014.3001.5501
  C++知识库 最新文章
【C++】友元、嵌套类、异常、RTTI、类型转换
通讯录的思路与实现(C语言)
C++PrimerPlus 第七章 函数-C++的编程模块(
Problem C: 算法9-9~9-12:平衡二叉树的基本
MSVC C++ UTF-8编程
C++进阶 多态原理
简单string类c++实现
我的年度总结
【C语言】以深厚地基筑伟岸高楼-基础篇(六
c语言常见错误合集
上一篇文章      下一篇文章      查看所有文章
加:2021-07-14 10:43:38  更:2021-07-14 10:44:14 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年5日历 -2024/5/4 0:03:18-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码