补题长征
我欲于此处证道(补题题解)
159739
这个作者很懒,什么都没留下…
展开
-
codeforces 722C Destroying Array
题意:给出长度为n的序列,每次去掉一个数,使得序列分成几块,问当前权值最大块的权值。 思路:提供两种,第一种用multiset和前缀和直接暴力模拟。 第二种用并差集,假设坐标i为一个去掉的数,那么f[i]记录的是i所在连续的去掉的数的区间的最左端,其余的看代码QAQ。第一种#include<bits/stdc++.h>using namespace std;long ...原创 2018-04-17 19:14:04 · 207 阅读 · 0 评论 -
codeforces761 B. Dasha and friends
题意:告诉你两个运动员与跑道上每个障碍物的距离和跑道的长度,要求你判断他们是否在同一跑道; 思路:可以通过已知条件得知两个由相邻障碍物之间的距离组成的序列,判断两个序列是否相等即可;#include <bits/stdc++.h>using namespace std;int a[105], b[105];int main() { int n, l; ...原创 2018-03-28 21:14:52 · 172 阅读 · 0 评论 -
codeforces761 C. Dasha and Password
题目大意:这是一个类似组合密码的东西。初始状态密码设置在第一列,我们可以通过拨动来改变每一行的密码。合法的密码必须满足三个条件:1.至少有一个数字。2.至少有一个小写字母。3.至少有一个特殊字符(*&#)问最少拨动多少下就能得到合法的密码。思路:分组背包加状态压缩#include <bits/stdc++.h>using namespace std;char s[55];...原创 2018-03-28 21:23:47 · 150 阅读 · 0 评论 -
codeforces761 D. Dasha and Very Difficult Problem
题意简单不解释了;思路:就按ci的大小将序列c从小到大排个序,然后满足bi-ai>(bi-1)-(ai-1)即可;#include <bits/stdc++.h>using namespace std;struct node { int a, c, id; bool operator<(const node &x)const { ...原创 2018-03-28 21:26:59 · 141 阅读 · 0 评论 -
HDU2128 (dfs)Tempter of the Bone II
我是题目快戳我The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze was changed and the way he came in was lost.He realized that the bone ...原创 2018-03-20 21:09:00 · 298 阅读 · 1 评论 -
CodeForces 1C
题意:给出正多边形的三个顶点,求正多边形的最小面积; 思路: 海伦公式: p=(a+b+c)/2,S=√p(p-a)(p-b)(p-c)(a,b,c为三角形的三边,S为三角形面积) 1.求外接圆半径r=a*b*c/4S 2.由余弦定理求出三个圆心角num[3] (要注意的是,当三个点在同一段半圆弧上时,这时第三个圆心角应该用2π-num[0]-num[1],防止麻烦直接就令num[2]=2原创 2017-08-11 20:51:09 · 330 阅读 · 0 评论 -
CodeForces - 686B 简单的排序
题目链接:http://codeforces.com/problemset/problem/686/B题意:给你一串数字,要你把它从小到大排序,并输出每次排序的操作,具体情况题目有具体介绍;思路:简单的排序题,看代码#include<iostream>#include<cmath>#include<stdio.h>#include<cstring>#include<algorithm>#i原创 2017-03-26 20:09:26 · 364 阅读 · 0 评论 -
CodeForces - 5C
题意:给定一个由字符 ( 和 ) 组成的字符串。您需要找出它的最长子串,且该子串是一个合格的括号序列。同时,还需要找出这样的子串的数目。(像(),(())样的为合格的括号序列,((()())为不合格); 思路:设dp[i]表示到第i个右括号所获串的长度。则dp[i]=dp[t-1]+i-t+1。t表示离i最近的那个左括号的位置。#include<iostream>#include<algorit原创 2017-08-12 10:11:20 · 201 阅读 · 0 评论 -
Coderforces 20C 最短路记录路径
题意:给定一个带权无向图。你需要求出从点 1 到点 n的最短路。 思路:使用Dijkstra算法,当进行松弛操作时用数组记录下前缀,输出时先从n向1回溯记录再输出;#include<iostream>#include<algorithm>#include<string>#include<cstring>#include<map>#include<queue>#include<cmath原创 2017-08-23 19:07:35 · 347 阅读 · 0 评论 -
CodeForces - 27C
题意:再给定的序列中找出一组最短的无序子序列#include<iostream>#include<algorithm>#include<string>#include<cstring>#include<map>#include<queue>#include<cmath>#include<stack>#include<vector>#include<cstdio>#define M原创 2017-08-23 19:10:34 · 204 阅读 · 0 评论 -
Codeforces 842B 简单几何
题意:平面上有一个圆心为原点的圆,半径为r,内圆半径为r-d(题意读错以为d是内圈半径,wa到爆炸),询问n个小圆zi(zi为半径),问有多少个圆完全在外壳内(即完全在圆内,但与内圈无交集); 思路:已知n个圆的圆心xi,yi,可以知道圆心距为sum=sqrt(xi*xi+yi*yi),那么只需要保证sum>=r-d+zi&&sum+zi<=r即为完全在外壳内;#include<iostream>原创 2017-08-30 10:58:18 · 357 阅读 · 0 评论 -
Codeforces842C dfs+set
题意:有一颗n个点,n-1条边的树,每个点的权值为wi,问从1到每个点,每条路径所经过点的gcd,可以选择将该条路径中某一个点改为0; 思路:dfs是肯定要的,至于set处理看代码吧;#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<map>#include<stack>#includ原创 2017-08-30 11:03:15 · 366 阅读 · 0 评论