NKOJ3485 【2015多校联训4】数据】的更多相关文章

问题描述 Mr_H 出了一道信息学竞赛题,就是给 n 个数排序.输入格式是这样的:试题有若干组数据.每组数据的第一个是一个整数 n,表示总共有 n 个数待排序:接下来 n 个整数,分别表示这n 个待排序的数.例如:3 4 2 –1 4 1 2 3 4,就表示有两组数据.第一组有3 个数(4,2,-1),第二组有4个数(1,2,3,4).可是现在Mr_H 做的输入数据出了一些问题.例如:2 1 9 3 2 按理说第一组数据有2 个数(1,9),第二组数据有3 个数,可是“3”后面并没有出现三个数,…
pid=5288">http://acm.hdu.edu.cn/showproblem.php?pid=5288 Problem Description OO has got a array A of size n ,defined a function f(l,r) represent the number of i (l<=i<=r) , that there's no j(l<=j<=r,j<>i) satisfy ai mod aj=0,now…
pid=5379">http://acm.hdu.edu.cn/showproblem.php? pid=5379 Problem Description Little sun is an artist. Today he is playing mahjong alone. He suddenly feels that the tree in the yard doesn't look good. So he wants to decorate the tree.(The tree has…
总算今天静下心来学算法.. Description Innocent Wu follows Dumb Zhang into a ancient tomb. Innocent Wu’s at the entrance of the tomb while Dumb Zhang’s at the end of it. The tomb is made up of many chambers, the total number is N. And there are M channels connect…
最近一个项目中有个前台对于表头要求: 给定一个日期期间返回形如 Mar 2015 3/20-3/31Apr 2015 4/1-4/30 这样的月年数据,简单的写了下代码,暂时没想到更好的办法 例如传进来的参数是 "2015-03-20"-"2016-04-08" 这样的形式 分三段处理: 第一段:起始日期的起始日期的月底 第二段:开始和结束月之间的所有月数据 第三段:结束日期的月初到结束日期 public List<String> loadMonthSt…
Zero Escape Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 289    Accepted Submission(s): 135 Problem Description Zero Escape, is a visual novel adventure video game directed by Kotaro Uchiko…
First One Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 831    Accepted Submission(s): 253 Problem Description soda has an integer array a1,a2,…,an. Let S(i,j) be the sum of ai,ai+1,…,aj. No…
Assignment Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 627    Accepted Submission(s): 318 Problem Description Tom owns a company and he is the boss. There are n staffs which are numbered fr…
http://acm.hdu.edu.cn/showproblem.php? pid=5294 Problem Description Innocent Wu follows Dumb Zhang into a ancient tomb. Innocent Wu's at the entrance of the tomb while Dumb Zhang's at the end of it. The tomb is made up of many chambers, the total num…
Virtual Participation Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 237    Accepted Submission(s): 56 Special Judge Problem Description As we know, Rikka is poor at math. Yuta is worrying abo…
Connect the Graph Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 108    Accepted Submission(s): 36 Special Judge Problem Description Once there was a special graph. This graph had n vertices a…
Tricks Device Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1977    Accepted Submission(s): 509 Problem Description Innocent Wu follows Dumb Zhang into a ancient tomb. Innocent Wu’s at the en…
Crazy Bobo Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others) Total Submission(s): 1215    Accepted Submission(s): 366 Problem Description Bobo has a tree,whose vertices are conveniently labeled by 1,2,...,n.Each nod…
Fantasy magicians usually gain their ability through one of three usual methods: possessing it as an innate talent, gaining it through study and practice, or receiving it from another being, often a god, spirit, or demon of some sort. Some wizards ar…
Solve this interesting problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 422    Accepted Submission(s): 98 Problem Description Have you learned something about segment tree? If not, don’t…
Painter Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 895    Accepted Submission(s): 408 Problem Description Mr. Hdu is an painter, as we all know, painters need ideas to innovate , one day,…
Your current task is to make a ground plan for a residential building located in HZXJHS. So you must determine a way to split the floor building with walls to make apartments in the shape of a rectangle. Each built wall must be paralled to the buildi…
Delicious Apples Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others) Total Submission(s): 1371    Accepted Submission(s): 448 Problem Description There are n apple trees planted along a cyclic road, which is L metres…
Friends Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 163    Accepted Submission(s): 61 Problem Description There are n people and m pairs of friends. For every pair of friends, they can choo…
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 593    Accepted Submission(s): 164 Problem Description There are n circles on a infinitely large table.With every two circle, either one contains…
OO’s Sequence Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 449    Accepted Submission(s): 158 Problem Description OO has got a array A of size n ,defined a function f(l,r) represent the nu…
Assignment Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 148    Accepted Submission(s): 71 Problem Description Tom owns a company and he is the boss. There are n staffs which are numbered fro…
题意:给出一个数列.问当中存在多少连续子区间,当中子区间的(最大值-最小值)<k 思路:设dp[i]为从区间1到i满足题意条件的解.终于解即为dp[n]. 此外 如果对于arr[i] 往左遍历 一直到arr[r] 此时从区间r到区间i满足(最大值-最小值)<k,再往左一位即越界 或者 不满足条件,此时有 dp[i] = dp[i-1] + i - r + 1; 由于数据量大 往左遍历时 可能会超时 ,所以用rmq打表 查找r时用二分 就过了 代码: #include <algorithm…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5289 题意:给你n个数和k,求有多少的区间使得区间内部任意两个数的差值小于k,输出符合要求的区间个数 思路:求出区间的最大最小值,只要他们的差值小于k,那么这个区间就符合要求,但是由于n较大,用暴力一定超时,所以就要用别的方法了:而RMQ是可以求区间的最值的,而且预处理的复杂度只有O(nlogn),而查询只是O(1)处理,这样相对来说节约了时间,再根据右端点来二分枚举左端点(其实不用二分好像更快,估…
就 背景描述 一排 N 个数, 第 i 个数是 Ai , 你要找出 K 个不相邻的数, 使得他们的和最大. 请求出这个最大和. 输入格式 第一行两个整数 N 和 K. 接下来一行 N 个整数, 第 i 个整数表示 Ai . 输出格式 一行一个整数表示最大和, 请注意答案可能会超过 int 范围 样例输入 3 2 4 5 3 样例输出 7 数据范围 对于 20% 的数据, N, K ≤ 20 . 对于 40% 的数据, N, K ≤ 1000 . 对于 60% 的数据, N, K ≤ 10000…
Password password.in/.out 描述 你来到了一个庙前,庙牌上有一个仅包含小写字母的字符串 s. 传说打开庙门的密码是这个字符串的一个子串 t,并且 t 既是 s 的前缀又是 s 的后缀并且还在 s 的中间位置出现过一次. 如果存在这样的串,请你输出这个串,如有多个满足条件的串,输出最长的那一个. 如果不存在这样的串,输出"Just a legend"(去掉引号). 输入格式 仅一行,字符串 s. 输出格式 如题所述 样例输入 fixprefixsuffix 样例输…
OO's Sequence Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 955    Accepted Submission(s): 358 Problem Description OO has got a array A of size n ,defined a function f(l,r) represent the nu…
Cake Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 965    Accepted Submission(s): 119 Special Judge Problem Description There are m soda and today is their birthday. The 1-st soda has prepa…
The sum of gcd Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 23    Accepted Submission(s): 4 Problem Description You have an array A,the length of A is n Let f(l,r)=∑ri=l∑rj=igcd(ai,ai+1....a…
把这题想复杂了,一直在考虑怎么快速的判断将选的边和已选的边无冲突,后来经人提醒发现这根本没必要,反正数据也不大开两个数组爆搜就OK了,搜索之前要先排除两种没必要搜的情况,这很容易想到,爆搜的时候注意几个小细节就可以了(代码代码注释中已标好) #include<cstdio> #include<cstring> #include<iostream> #include<vector> #include<utility> using namespace…