题意:你要带着你的喵咪一起去旅行,你的喵在星期$1,4,7$吃喵粮$x$,在星期$2,6$吃喵粮$y$,在星期$3,5$吃喵粮$z$,你只有$a$个$x$,$b$个$y$,$c$个$z$,一旦吃完旅行就结束了,问你选择星期几出发能使旅行的天数最长. 题解:这已经是这个星期第三次碰到这种idea的题了 ...
分类:
其他好文 时间:
2020-11-19 12:46:14
阅读次数:
9
主要介绍了deque容器的基本概念,deque容器的构造函数,deque容器的赋值操作,如何查看deque容器的大小,deque容器中如何插入和删除数据,使用deque容器进行数据存取,以及给deque容器中的数据进行排序操作。 ...
分类:
其他好文 时间:
2020-11-17 12:38:31
阅读次数:
8
#include<iostream> #include<cstring> using namespace std; const int maxn=50010; int head[maxn],cnt; int dfn[maxn],low[maxn],tot,stack[maxn],idx,visit[ ...
分类:
其他好文 时间:
2020-11-13 12:49:27
阅读次数:
7
#include <random> #include <iostream> int main() { std::random_device rd; //Will be used to obtain a seed for the random number engine std::mt19937 ge ...
分类:
编程语言 时间:
2020-11-13 12:42:56
阅读次数:
7
#include<iostream>#include<iomanip>usingnamespacestd;intmain(){inti,j;for(i=1;i<=9;i++){for(j=1;j<i;j++)cout<<j<<""<<i<<"="<<setw(2)
分类:
编程语言 时间:
2020-11-12 14:11:00
阅读次数:
11
先看两个例子,比较不同: 例一(有回调函数) #include <iostream> using namespace std; void foo_one() { cout<<"foo_one"<<endl; } void foo_two() { cout<<"foo_two"<<endl; } ty ...
分类:
其他好文 时间:
2020-11-11 16:29:50
阅读次数:
8
17. Iterator(迭代器) 17.1 定义 提供一种方法访问一个容器对象中各个元素,而又不需暴露该对象的内部细节 17.2 优点 ■它支持以不同的方式遍历一个聚合对象。 ■迭代器简化了聚合类。 ■在同一个聚合上可以有多个遍历。 ■在迭代器模式中,增加新的聚合类和迭代器类都很方便,无须修改原有 ...
分类:
其他好文 时间:
2020-11-08 17:57:34
阅读次数:
33
思路: 1,利用左右指针的思想 2,因为至少要有两个数,所以最大值为:(1+sum) / 2; 3,指定起始序列为1,2 举个例子,sum=9的情况 实现 void findContinuousSequence(int sum){ if(sum < 3){ return; } int small = ...
分类:
其他好文 时间:
2020-11-06 01:19:11
阅读次数:
17
#include <bits/stdc++.h> using namespace std; const int mn=1e6+7; const int mod=1e9+7; int v[mn],p[mn],s[mn]; int main() { int n,tot=0; cin>>n; for(in ...
分类:
其他好文 时间:
2020-11-02 10:09:59
阅读次数:
47
#include <iostream> typedef struct node { int nVal; node* pNext; node(int val) : nVal(val), pNext(nullptr) {} }; // create node* create_link(int nNode ...
分类:
其他好文 时间:
2020-11-02 09:58:50
阅读次数:
18