
ACM
文章平均质量分 53
VigiIante
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
二维容器Vector动态初始化
今天又是自闭的一天,看一下自闭之后能获得哪些新知识呢 vector<vector<int> > a; int ans[maxn * maxn]; int main() { int n, m, d, q; cin >> n >> m >> d >> q; a = vector<vector<int>...原创 2019-04-23 18:18:03 · 1250 阅读 · 0 评论 -
洛谷P1880 [NOI1995]石子合并
这题是区间DP的模板题,发布题解的大佬用心良苦,故意把输入改了,一般需要把整个程序逻辑理解透彻才会知道哪里要改。 具体逻辑大佬讲的非常清楚,接下来是给代码时间: #include<algorithm> #include <iostream> #include <sstream> #include <cstring> #include &l...原创 2019-05-07 19:50:21 · 241 阅读 · 1 评论 -
马拉车模板题
链接:https://ac.nowcoder.com/acm/problem/23501 来源:牛客网 题目描述 小A非常喜欢回文串,当然我们都知道回文串这种情况是非常特殊的。所以小A只想知道给定的一个字符串的最大回文子串是多少,但是小A对这个结果并不是非常满意。现在小A可以对这个字符串做一些改动,他可以把这个字符串最前面的某一段连续的字符(不改变顺序)移动到原先字符串的末尾。那么请问小A...原创 2019-05-07 21:00:49 · 374 阅读 · 0 评论 -
Codeforces Round #402 (Div. 2)题解
A. Pupils Redistribution https://codeforces.com/contest/779/problem/A 题意就是把数字1到5平均分到两个班内,题水但是判定容易出BUG #include<bits/stdc++.h> using namespace std; constexpr int maxl = 6; int numa[maxl], num...原创 2019-06-04 10:52:09 · 306 阅读 · 0 评论 -
矩阵快速幂中矩阵的构造
其实快速幂和矩阵快速幂是异曲同工,但是往往构造矩阵是难点,转载一个别人博客写的矩阵构造方法: Fibonacci数列:F(0)=1 , F(1)=1 , F(n)=F(n-1)+F(n-2) 我们以前快速求Fibonacci数列第n项的方法是 构造常系数矩阵 (一) Fibonacci数列f[n]=f[n-1]+f[n-2],f[1]=f[2]=1的第n项快速求法(不考虑高精度) ...转载 2019-07-07 18:51:44 · 229 阅读 · 0 评论 -
Codeforces Round #567 (Div. 2) B. Split a Number题解
B. Split a Number time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output Dima worked all day and wrote down on a long paper strip his fa...原创 2019-07-02 16:25:05 · 349 阅读 · 0 评论 -
2019牛客暑期多校训练营(第一场)题解
JFraction Comparision 题意:给出x, a, y, b, 判断x / a与y / b的大小 思路:数字太大需要大数,计算x * b与y *a的大小,再判断 实现:JAVA大数 import java.math.BigInteger; import java.util.*; public class Main { public static void ...原创 2019-07-19 16:26:11 · 220 阅读 · 0 评论 -
校赛题解
题意很好理解,需要优先队列 #include<bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; typedef long long int ll; struct Node{ ll a, b, num1, num2; bool operator < (const Node y) c...原创 2019-07-27 16:23:58 · 190 阅读 · 0 评论 -
滚动数组的实现
#include<bits/stdc++.h> using namespace std; int dp[2][maxn] int main() { for(int i = 1; i <= n; i++) { for(int j = 0; j <= w; j++) { if(j < w[i]) ...原创 2019-07-28 20:17:46 · 321 阅读 · 0 评论 -
2019牛客暑期多校训练营(第七场)E Find the median题解(极其复杂的离散化)
涉及一个很复杂的离散化和线段树的区间更新区间查询,目前代码看不懂,需要时间再研究 xls代码: #include<bits/stdc++.h> #define ll long long using namespace std; const int maxn = 8e5 + 10; ll sum[maxn * 4]; int S[maxn], L[maxn], R[...原创 2019-08-09 16:36:15 · 180 阅读 · 0 评论 -
2019杭电多校Problem 5 Snowy Smile题解
转化为维护最大连续子串和 #include<bits/stdc++.h> #define ll long long #define pi pair<int, ll> #define mk make_pair using namespace std; const int maxn = 2010; struct node { int x, y; ll...原创 2019-08-07 20:04:39 · 265 阅读 · 0 评论 -
Codeforces Round #554 (Div. 2) Problem B. Neko Performs Cat Furrier Transform
https://codeforces.com/contest/1152/problem/B 大致思路是找到二进制n的第一个0, 然后模拟,与位操作有关 #include<algorithm> #include <iostream> #include <sstream> #include <cstring> #include <cst...原创 2019-04-26 09:46:52 · 150 阅读 · 0 评论 -
April Fools Day Contest 2019 A. Thanos Sort题解
愚人节专场比我想象的难一些(太菜了) 代码来自一个博客:https://blog.youkuaiyun.com/qq_38185591/article/details/88966801 题目链接:https://codeforces.com/contest/1145/problem/A 主要考验dfs能力,我第一次写了110行代码没过卡题 贴代码: #include<algorithm&...原创 2019-04-02 23:45:33 · 292 阅读 · 0 评论 -
洛谷P1028 数的计算
这题是递归加打表加DP(给大佬ORZ) 打表代码: #include<iostream> using namespace std; int sum = 0; void dfs(int n) { sum++; if (n == 1) return; for (int i = 1; i <= n / 2; i++) dfs(i); } int main() { in...原创 2019-04-04 01:10:11 · 188 阅读 · 0 评论 -
Chiaki Sequence Revisited题解
首先顺着题目逻辑打表 打表代码: #include<iostream> #include<string> #include<vector> using namespace std; int lowbit(int x) { return x&(-x); } int main() { int N; int a[1007] = { 1,1 };...原创 2019-07-08 09:38:12 · 168 阅读 · 0 评论 -
C++实现插入排序算法
#include<iostream> #include<string> #include<Windows.h> using namespace std; int main() { char mid; string a; getline(cin, a); int N = a.size(); for(int i = 1; i < N;++i) ...原创 2018-07-21 16:58:44 · 238 阅读 · 0 评论 -
希尔排序
希尔排序为了加快速度简单地改进了插入排序,交换不相邻的元素以对数组的局部进行排序,并最终用插入排序将局部有序的数组排序。 实现希尔排序的一种方法是对于每个h,用插入排序将h个子数组独立地排序。但因为子数组是相互独立的,一个简单的方法是在h-子数组中将每个元素交换到比它大的元素之前去(将比它大的元素向右移动一格)。只需要在插入排序的代码中移动元素的距离由1改为h即可。这...原创 2018-07-22 15:25:58 · 194 阅读 · 0 评论 -
Problem L. Visual Cube题解(一个有意思的题目)
题目分析: Problem Description Little Q likes solving math problems very much. Unluckily, however, he does not have good spatial ability. Everytime he meets a 3D geometry problem, he will struggle to dra...原创 2018-07-31 14:22:34 · 389 阅读 · 0 评论 -
简单的内存池
在使用指针时,内存的分配是一个很头疼的问题,为了防止内存溢出,以二叉树为例搭建一个简单的内存池。 queue<Node *>freenodes; Node node[maxn]; void init() { for (int i = 0; i < maxn; i++) freenodes.push(&node[i]);//初始化内存池 } Node * newn...原创 2018-08-07 10:33:40 · 148 阅读 · 0 评论 -
例题6-8 树(Tree,UVa 548)(刘汝佳算法竞赛)
#include<algorithm> #include <iostream> #include <sstream> #include <cstring> #include <cstdlib> #include <string> #include <vector> #include &l原创 2018-08-07 16:50:14 · 333 阅读 · 0 评论 -
NOIP选手必知的编程技巧
作者:StudyingFather https://studyingfather.blog.luogu.org/some-coding-tips-for-oiers 本文将给各位介绍一些无论是平时训练或者参加比赛时都比较有用的编程技巧,它们可以让我们的程序可读性更强,方便我们的调试,有些技巧甚至可以帮助我们获得更多的分数。 文章地址:https://studyingfather.blog.l...转载 2018-11-12 22:18:36 · 401 阅读 · 0 评论 -
洛谷 P1047 校门外的树(线段树版)
https://www.luogu.org/problemnew/show/P1047 第一次脱离模板写线段树题目(洛谷的线段树模板题太变态了)。言归正传,这是一个未完成版的线段树,因为一直到最后都没有发现为什么第一组数据会WA.后来苦心研究之后,发现线段树处理0的时候会有问题,于是想了两个解决办法应对该情况。 这个题目唯一的坑点在于从0开始,意思是输入的500实质上有501棵树,而线段树的结...原创 2018-11-19 21:44:04 · 264 阅读 · 0 评论 -
Codeforces Round #529 (Div. 3) C. Powers Of Two题解及思路
time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Ivan wants to play a game with you. He picked some string ss of length nn consis...原创 2018-12-28 21:15:55 · 237 阅读 · 0 评论 -
Codeforces Round #544 (Div. 3) B. Preparation for International Women's Day题解
https://codeforces.com/contest/1133/problem/B #include<algorithm> #include <iostream> #include <sstream> #include <cstring> #include <cstdlib> #include <string&...原创 2019-03-12 18:42:27 · 1130 阅读 · 0 评论 -
Codeforces Round #544 (Div. 3) D. Zero Quantity Maximization题解
https://codeforces.com/contest/1133/problem/D #include<algorithm> #include <iostream> #include <sstream> #include <cstring> #include <cstdlib> #include <string&...原创 2019-03-12 20:19:16 · 140 阅读 · 0 评论 -
C++解决ACM直播状态输出控制
题目:在比特镇举行的中国大学生程序设计竞赛CCPC(China Collegiate Programming Contest)开始啦!这次比赛中加入了现场视频直播,而在直播屏幕的左下角,会显示评测队列。 比特镇的科技水平并不发达,直播分辨率并不高。准确地说,每个评测记录将被显示在11行3838列的像素格上。一条评测记录由44个部分组成,从左往右依次为排名(33像素),队名(1616像素),题号(4...原创 2018-06-25 21:25:11 · 636 阅读 · 0 评论