HDU - 6570 - Wave(暴力)】的更多相关文章

Avin is studying series. A series is called "wave" if the following conditions are satisfied: 1) It contains at least two elements; 2) All elements at odd positions are the same; 3) All elements at even positions are the same; 4) Elements at odd…
Bazinga Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5510 Description Ladies and gentlemen, please sit up straight. Don't tilt your head. I'm serious.For n given strings S1,S2,⋯,Sn, labelled from 1 to n, you…
Numbers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5522 Description 给n个数A1,A2....An{A}_{1},{A}_{2}....{A}_{n}A​1​​,A​2​​....A​n​​,从中选3个位置不同的数A,B和C,问是否有一种情况满足A-B=C. Input There are multiple test cases, no mo…
题目链接:hdu 5077 NAND 题目大意:Xiaoqiang要写一个编码程序,然后依据x1,x2,x3的值构造出8个字符.如今给定要求生成的8个字符.问 说Xiaoqiang最少要写多少行代码.代码内容仅仅能为NAND操作和return操作,操作的变量能够是常数. 解题思路:输入总共就256中情况,所以暴力剪枝打表,打表的代码手贱给删了...所以就将一下思路.开一个s数组 表示变量,然后相应每一层每次两个变量进行NAND操作. 大致三个剪枝,dfs时候,变量出现同样就跳过.8个字符能够直接…
GCD/center> 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5726 Description Give you a sequence of N(N≤100,000) integers : a1,...,an(0<ai≤1000,000,000). There are Q(Q≤100,000) queries. For each query l,r you have to calculate gcd(al,,al+1,...,ar) a…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4291 思路:首先保留求出循环节,然后就是矩阵求幂了. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; typedef __int64 ll; #define MOD2 1000000007 #define MOD1 222…
因为题目当中的k比较小k <= 10,所以可以直接枚举,题目里面由两个trick, 一个是如果每个点都可以放稻草人的话,那么答案是0, 另外一个就是如果可以放稻草人的点不用被照到.知道了这两个基本上暴力既可以ac了 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; ; struct Point { int…
题目链接:hdu 4499 Cannon 题目大意:给出一个n*m的棋盘,上面已经存在了k个棋子,给出棋子的位置,然后求能够在这种棋盘上放多少个炮,要求后放置上去的炮相互之间不能攻击. 解题思路:枚举行放的情况,用二进制数表示,每次放之前推断能否放下(会不会和已经存在的棋子冲突),放下后推断会不会互相攻击的炮,仅仅须要对每一个新加入的炮考虑左边以及上边就能够了. #include <cstdio> #include <cstring> #include <algorithm&…
USACO ORZ Time Limit: 5000/1500 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2291    Accepted Submission(s): 822 Problem Description Like everyone, cows enjoy variety. Their current fancy is new shapes for pastur…
题目:Click here 题意:给你n个点,有多少个正多边形(3,4,5,6). 分析:整点是不能构成正五边形和正三边形和正六边形的,所以只需暴力枚举四个点判断是否是正四边形即可. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #define power(x) ((x)*(x)) using names…
odds Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 250    Accepted Submission(s): 72 Problem Description 度度熊有一棵 N 个节点 (node) 的有根树 (rooted tree),树上的每条边 (edge) 都有一个整数的权重,对于每一个非叶的节点 (non-leaf n…
为甚么16年Qingdao Online 都是暴力题emm///... 先暴力预处理 然后lower _bound二分 #include <iostream> #include <cstdio> #include <sstream> #include <cstring> #include <map> #include <cctype> #include <set> #include <vector> #incl…
面试n个人,可以分任意组数,每组选一个,得分总和严格大于k,问最少分几组 就是暴力嘛...想到就去写吧.. #include <iostream> #include <cstdio> #include <sstream> #include <cstring> #include <map> #include <set> #include <vector> #include <stack> #include <…
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=2089 不要62 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 54847    Accepted Submission(s): 21063 Problem Description 杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer).杭州交…
Chip Factory Time Limit: 18000/9000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 5394    Accepted Submission(s): 2422 Problem Description John is a manager of a CPU chip factory, the factory produces lots of chi…
TIANKENG manages a restaurant after graduating from ZCMU, and tens of thousands of customers come to have meal because of its delicious dishes. Today n groups of customers come to enjoy their meal, and there are Xi persons in the ith group in sum. As…
先来看看比较显然的几个局面 (a,0) 先手必败 (a,a) 先手必胜 (a,ak) 先手必胜 (a,ak+r),k>1 先手必胜,因为先手有主动权把(a,r)让给后手或留给自己 对于开局(a,r),r<a&&a/r<2,比较难分析,我们用暴力直接跑出结果 挑战程序设计竞赛把这种主动权成为自由度,名字真高端 这次的代码写的不怎么简练,不过能AC #include<iostream> #include<algorithm> #include<c…
Shopping Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 758    Accepted Submission(s): 254 Problem Description You have just moved into a new apartment and have a long list of items you need t…
题意:数独. 析:由于只是4*4,完全可以暴力,要注意一下一些条件,比如2*2的小方格也得是1234 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #include <iostream> #include &…
题意:给定一篇文章,将每个单词的首尾字母不变,中间顺序打乱,然后将单词之间的空格去掉,得到一个序列,给出一个这样的序列,给你一个字典,将原文翻译出来. 析:在比赛的时候读错题了,忘记首尾字母不变了,一直WA.暴力求解,去深搜每个单词,做一些恰当的优化,能不进行的就不进行.胡搞的. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <strin…
题意:给出一个数n,问n能否是斐波那契数列中数的乘积 先刷选 斐波那契数列,然后就枚举 #include <cstdio> #include <cstring> #include <queue> #include <map> #include <iostream> using namespace std; typedef long long LL; ; LL num[]; map<LL, bool> m; void init() {…
字符串匹配函数strcmp 直接使用来判断两字符串是否完全相等 用数组存每个单词的个数时  初始化为零就错 初始化为一时就正确  也不知道为什么…
题意:给定n,k,l,接下来给出n个数,让你从n个数中选取k个数围成一圈,然后从这k个数中随意选出连续的m(m>=1&&m<=k)个数进行异或后得到[l,r]区间的所有值,让你求最大的r. 分析:关键问题是需要剪枝! 代码实现: #include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #inclu…
题意:在矩阵中,找一条路从 (1,1)->(n,m),使方差最小 思路: T = (N+M−1)∑N+M−1i=1(Ai−Aavg)2 将N + M - 1乘进去,即求1 ~ N+M-1,(N + M - 1)*A[i] - (A[i] + ..... + A[N]) 的和由于 假设Aavg可以是任何数,但只有当其是平均值时T才会最小(感觉别人都好厉害 /(ㄒoㄒ)/~~) #include <iostream> #include <cstdio> #include <…
<题目链接> 题目大意:给定一颗带点权的树,进行两种操作,k=0,更改某一点的点权,k!=0,输出a~b路径之间权值第k大的点的点权. 解题分析:先通过RMQ的初始化,预处理pre[]数组,并且求出a和b的LCA.然后利用LCA将a.b路径上所有点的点权全部存储起来,将其排序,就可得到a.b路径上权值第k大的点权.具体操作为:利用pre[]数组,从a到LCA的所有点权全部相加,然后再将从b到LCA的所有点权相加,就可以得到a.b路径上所有点的点权.下面用的是LCA转RMQ的方法求解. #inc…
题意:要求在一个字符串中找出三段,然后能拼成一个固定的单词,问是否可行 BC周年庆第二题,我枚举了那个单词的切断位置,然后到给的字符串里分别找,然后就没有然后了``` #include<stdio.h> #include<string.h> #include<algorithm> #include<math.h> using namespace std; ]; ]=" anniversary"; ; bool check(int a,in…
Walk Time Limit: 30000/15000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 266    Accepted Submission(s): 183 Special Judge Problem Description I used to think I could be anything, but now I know that I couldn't d…
题目大意:给出n个点的权值.m条边,2种操作 0 u num,将第u个点的权值改成num k u v,询问u到v这条路上第k大的权值点 解题思路:该点的话直接该,找第k大的话直接暴力 #include <cstdio> #include <cstring> #include <algorithm> using namespace std; #define N 80010 #define M 160010 struct Edge{ int to, next, val; }…
GSM Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 569    Accepted Submission(s): 182 Problem Description Xiao Ming is traveling around several cities by train. And the time on the train is ve…
定义一种数位simth数,该数的各位之和等于其所有质因子所有位数字之和,现给出n求大于n的最小该种数,n最大不超过8位,那么直接暴力就可以了. /** @Date : 2017-09-08 14:12:08 * @FileName: HDU 1333 素因子 暴力.cpp * @Platform: Windows * @Author : Lweleth (SoungEarlf@gmail.com) * @Link : https://github.com/ * @Version : $Id$ *…