摘要:
基姆拉尔森计算公式:给定年月日判断这一天是星期几 #include <iostream> #include <string> using namespace std; string weekdays[7] = {"Sunday", "Monday", "Tuesday", "Wednesday", 阅读全文
摘要:
原题链接:https://www.luogu.com.cn/problem/P4316 这题是经典的概率dp题,通常看到的题解都是逆推的做法,实际上理解了题目的含义后发现逆推其实是正推的一种特殊情况而已 正推做法: 定义dp[i]表示从1~i的路径长度的期望,那么dp[1] = 0,答案就是dp[n 阅读全文
摘要:
## 直线求交点 题目链接:[https://www.acwing.com/problem/content/3693/](https://www.acwing.com/problem/content/3693/)  安装node.js hexo需要node.js支持,所以需 阅读全文
摘要:
11. 盛最多水的容器 比较暴力的做法: class Solution { public: int maxArea(vector<int>& h) { vector<int> t; int n = h.size(); int res = -1; for(int i = 0; i < n; i++) 阅读全文
摘要:
1. 两数之和 哈希表:O(n) class Solution { public: vector<int> twoSum(vector<int>& nums, int target) { unordered_map<int, int> hs; int n = nums.size(); for(int 阅读全文
摘要:
C++对于文件的操作需要包含<fstream>头文件 文件类型分为两种: 文本文件-文件以文件的ASCII码的形式存储在计算机中 二进制文件-文件以文本的二进制形式存储在计算机中,用户一般不能直接读懂它们 操作文件的三大类: ofstream: 写操作 ifstream: 读操作 fstream: 阅读全文