做法:记录每个点i向左与它最近的不互质的数j,从j+1到i是可以分成1块的。 对于每次询问,从r开始一直贪心往前跳,每跳一步ans++;但这样一步一步跳会T,需要去倍增优化。 #include<bits/stdc++.h> using namespace std; #define ll long l ...
分类:
其他好文 时间:
2021-04-23 12:09:38
阅读次数:
0
typeid操作符可以用来获取一个类型/表达式的名称: #include <iostream> #include <typeinfo> using namespace std; int main() { std::cout << typeid(int).name() << std::endl; re ...
分类:
其他好文 时间:
2021-04-23 12:05:50
阅读次数:
0
原题链接 考察:搜索 思路: 预处理有子弹和城堡的坐标,这部分除了暴力没有更好的办法.因为还有一个时间限制,所以需要三维数组.剩下就是BFS. 剪枝: 1.相同时间的拜访点不必再访问. 2.当离终点的曼哈顿距离>能量 不必再走下去. 注意:城堡处一定要预处理再判断子弹. 1 #include <io ...
分类:
其他好文 时间:
2021-04-22 16:32:51
阅读次数:
0
A Tit for Tat 题意:给你一个n个数的数组,在k次操作下,每次可以选2个数,一个+1,一个-1,求如何让数组前面的数最小,后面的数最大。最小不能为0. 思路:模拟,把前面的数-掉都加在最后一个数上 #include<iostream> using namespace std; int n ...
分类:
其他好文 时间:
2021-04-22 16:23:39
阅读次数:
0
此处双指针代表的是一种思想,即两个(或多个)"先锋"动态式跟随并进行信息交流[个人理解],样例如下: 先输入数组大小,然后依次赋值(按照升序) ①若不得有重复元素,代码如下: 1 #include<iostream> 2 using namespace std; 3 4 const int N = ...
分类:
编程语言 时间:
2021-04-22 16:22:56
阅读次数:
0
#include <stdio.h> #include <iostream> using namespace std; class abc { private: int a; int b; }; int main() { cout << "Hello, World!" << endl; cout < ...
分类:
其他好文 时间:
2021-04-22 15:25:05
阅读次数:
0
c语言中continue语句;执行continue语句后,循环体的剩余部分就会被跳过。 例子; 1、原始程序。输出矩形。 #include <stdio.h> int main(void) { int i, j, height, width; puts("please input the heigh ...
分类:
编程语言 时间:
2021-04-22 15:24:21
阅读次数:
0
最近做题养成了一个不太好的习惯,习惯性的先去看discuss有没有坑,越是惧怕错误越可能出错,之后的锻炼,出错再去check discuss吧 简单的BFS #include <iostream> #include <algorithm> #include <queue> #include <str ...
分类:
其他好文 时间:
2021-04-21 12:34:23
阅读次数:
0
题目大意 给一个二叉树的中序遍历和前序遍历,求其镜像后的层序遍历 类似于 L2-006 树的遍历 (25 分) 建树 镜像就在dfs的时候先输出右子树 再 左子树 #include<bits/stdc++.h> using namespace std; struct node { int l,r; ...
分类:
其他好文 时间:
2021-04-21 12:12:05
阅读次数:
0
在配置好OpenGL开发库的环境下,在main.cpp文件中运行如下代码,从而学习。 配置方法:https://www.cnblogs.com/cchHers/p/14674397.html #include "GLShaderManager.h" //着色器管理器(shader manager)类 ...
分类:
其他好文 时间:
2021-04-21 11:55:44
阅读次数:
0