贪心搞就行,用map记录每个数出现的下标,每次都取首尾两个.将中间权值为负的删掉后取sum值最大的就行. #include<iostream> #include<algorithm> #include<vector> #include<string> #include<stack> #include<map> #include<set> #include<cstdio> #include<cstring&…
Codeforces Round #486 (Div. 3) D. Points and Powers of Two 题目连接: http://codeforces.com/group/T0ITBvoeEx/contest/988/problem/D Description There are n distinct points on a coordinate line, the coordinate of i-th point equals to xi. Choose a subset of…
C. Points on Plane Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/576/problem/C Description On a plane are n points (xi, yi) with integer coordinates between 0 and 106. The distance between the two points with numbers a and…
2018-02-25 http://codeforces.com/contest/940/problem/A A. Points on the line time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output We've got no test cases. A big olympiad is coming up. But the pr…
A. Points and Segments (easy) Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/430/problem/A Description Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on…
水到家了 #include <iostream> #include <vector> #include <algorithm> using namespace std; struct Point{ int index, pos; Point(, ){ index = index_; pos = pos_; } bool operator < (const Point& a) const{ return pos < a.pos; } }; int ma…
Points on Plane Problem's Link Mean: 在二维坐标中给定n个点,求一条哈密顿通路. analyse: 一开始忽略了“无需保证路径最短”这个条件,一直在套最短哈密顿通路的模板,无限TLE. 简单的构造,首先对x坐标设一个阀值,分段输出,从下到上.再从上到下.在从下到上...直到所有点输出完为止. 当然也可横向扫描输出. Time complexity: O(N) Source code:  ;;;;)                  ;}…
A. Points in Segments time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a set of nn segments on the axis OxOx , each segment has integer endpoints between 11 and mm inclusive. S…
A. Points on the line time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output We've got no test cases. A big olympiad is coming up. But the problemsetters' number one priority should be adding anot…
                                                                          C. Points on Plane On a plane are n points (xi, yi) with integer coordinates between 0 and 106. The distance between the two points with numbers a and bis said to be the follow…
传送门:http://codeforces.com/contest/988/problem/D 题意: 在一堆数字中,找出尽量多的数字,使得这些数字的差都是2的指数次. 思路: 可以知道最多有三个,差值为2.4:或者是a[i],a[i]+2的k次,a[i]-2的k次: 两个就直接找. 一个随便输出一个. ac代码 #include <iostream> #include <cstdio> #include <algorithm> #include <cstring…
题目大意:在一个平面里有n个点,点坐标的值在1-1e6之间,让你给出一个遍历所有点的顺序,要求每个点走一次,且 曼哈顿距离之和小于25*1e8. 思路:想了一会就有了思路,我们可以把1e6的x,y坐标都分成2000份,每份500,然后这样整个平面就被分成 了2000*2000个区域,然后按区域输出点就行了. #include<bits/stdc++.h> using namespace std; int n; vector<][]; int main() { scanf("%d…
time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Smart Beaver decided to be not only smart, but also a healthy beaver! And so he began to attend physical education classes at school X. In t…
Discription By the age of three Smart Beaver mastered all arithmetic operations and got this summer homework from the amazed teacher: You are given a sequence of integers a1, a2, ..., an. Your task is to perform on it mconsecutive operations of the f…
Number of Parallelograms CodeForces - 660D You are given n points on a plane. All the points are distinct and no three of them lie on the same line. Find the number of parallelograms with the vertices at the given points. Input The first line of the…
Summer Homework CodeForces - 316E3 By the age of three Smart Beaver mastered all arithmetic operations and got this summer homework from the amazed teacher: You are given a sequence of integers a1, a2, ..., an. Your task is to perform on it mconsecut…
1. 前言 在这篇博文中,我们将学习如何查询mongoDB中的数据.当我们把数据存储在mongoDB以后,我们需要把数据查询出来.毕竟CRUD操作中,查询操作在我们系统中是我们应用比较频繁的操作.我们需要应对不同的业务需求,构造合适的查询条件去查询我们想要的数据.我们需要去学习mongoDB给我们提供了哪些查询相关的语法和功能.在这里,我们使用mongodb自带的mongo shell(mongo shell是一个javascript环境的mongodb客户端,支持js语法)来学习. 2. 准备…
MSI Error 1603 installing AppFabric 1.1 / Win7 x64  Archived Forums A-B > AppFabric Caching   先说解决方式: 这是一个装过appfabric或者升级到1.1之后发生错误,然后重装造成的错误,原因是uninstall没有删干净全部的信息,有一个小bug~~~~~ 使用regedit打开注册表编辑器,然后定位“HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Contr…
Changing SID Server 2012  Windows Server > Windows Server 2012 General Question 0 Sign in to vote Hello, In Server 2008, to be able to create new VM using same (copied) VHD, we had to use SYSREP to change SID or 3rd party tools, if we wanted to join…
Query Method MongoDB provides the db.collection.find() method to read documents from a collection. The db.collection.find() method returns a cursor to the matching documents. db.collection.find( <query filter>, <projection> ) For the db.collec…
Optimal Point on a Line CodeForces - 710B You are given n points on a line with their coordinates xi. Find the point x so the sum of distances to the given points is minimal. Input The first line contains integer n (1 ≤ n ≤ 3·105) — the number of poi…
1.rplidar实时测试 参考文献:http://www.cnblogs.com/liangyf0312/p/8028441.html 修改USB转串口权限 yhexie@ubuntu:~$ cd /etc/udev/rules.d yhexie@ubuntu:/etc/udev/rules.d$ su Password: root@ubuntu:/etc/udev/rules.d# touch 70-ttyusb.rules root@ubuntu:/etc/udev/rules.d# vi…
https://www.codechef.com/DEC17/problems/VK18 #include<cstdio> #include<iostream> #include<algorithm> using namespace std; #define N 1000001 ],dp[N]; ]; void read(int &x) { x=; char c=getchar(); while(!isdigit(c)) c=getchar(); +c-'; c…
http://blog.csdn.net/guduruyu/article/details/72866144 最小二乘法多项式曲线拟合,是常见的曲线拟合方法,有着广泛的应用,这里在借鉴最小二乘多项式曲线拟合原理与实现的原理的基础上,介绍如何在OpenCV来实现基于最小二乘的多项式曲线拟合.   概念 最小二乘法多项式曲线拟合,根据给定的m个点,并不要求这条曲线精确地经过这些点,而是曲线y=f(x)的近似曲线y= φ(x). 原理 给定数据点pi(xi,yi),其中i=1,2,…,m.求近似曲线y…
Chef and Big Soccer   Problem code: CHEFSOC2 Tweet     ALL SUBMISSIONS All submissions for this problem are available. Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. Chef is a big fan of soccer! He loves soccer so much,…
Chef and Mover Problem Code: CHEFMOVR Chef's dog Snuffles has so many things to play with! This time around, Snuffles has an array A containing N integers: A1, A2, ..., AN. Bad news: Snuffles only loves to play with an array in which all the elements…
Description All submissions for this problem are available. Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. Chef is a big fan of soccer! He loves soccer so much, that he even invented soccer for his pet dogs! Here are th…
Greedy Candidates Problem Code: GCAC The placements/recruitment season is going on in various colleges. The interviews are over, and each company has selected some students. But since each student can end up finally in at most one company, a student…
今天开始接触非关系型数据库的mongoDB,现在将自己做的笔记发出来,供大家参考,也便于自己以后忘记了可以查看. 首先,mongoDB,是一种数据库,但是又区别与mysql,sqlserver.orcle等关系数据库,在优势上面也略高一筹:至于为什么会这么说呢?很简单,我们来举两个例子: 1.在存储上面,非关系型数据库可以更大规模的存储,打个比方,Facebook用的数据库就是非关系型数据库. 2.运用起来更加流畅也是这个数据库的优点,将分布式的特点发挥到极致. 当我查看官方文档的时候,简直要人…
[20 Points] Lernaean [by [Arrexel] 问题描述: Your target is not very good with computers. Try and guess their password to see if they may be hiding anything! 网站首页登陆界面 根据提示进行密码猜解 BP爆破得到密码,同时在响应包里面得到flag [30 Points] Cartographer [by Arrexel] 问题描述: Some und…