思维
siyutt
这个作者很懒,什么都没留下…
展开
-
codeforce834A
codeforces 834 A题目传送门题意:……….思路:一开始敲的模拟还敲错了/(ㄒoㄒ)/~~,看了别人的代码发现自己不单单是思想江化了,思维也江化了。#include <iostream> #include <fstream> #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #includ原创 2017-07-31 15:58:04 · 1708 阅读 · 0 评论 -
Codeforce931D(简单dfs+思维)
Peculiar apple-tree 传送门 题意:有一颗树,树上有n多花,都已经结果并按照一定规则掉落,把它们从1~n进行标号,只有当苹果掉到1时才能采摘。当偶数个掉到同一朵花上时,它们消失不见,如果是奇数则剩下一个。它们掉落的规则由一个大小为n-1的序列确定——–i花上的苹果掉到pi花上。保证它们的终点都为1; 思路:掉落的轨迹可以看出它是一棵树,并且只有同深度的苹果才能互相影响到...原创 2018-03-15 20:04:43 · 283 阅读 · 0 评论 -
Codeforce937B(暴力)
Vile Grasshoppers 题意:给你p和y,让你在(p,y]找一个最大的数,这个数不能被[2,p]中的数整除 #include <iostream> #include <fstream> #include <cstdio> #include <cstring> #include <queue> #include ...原创 2018-03-10 16:46:03 · 226 阅读 · 0 评论 -
Codeforce961C(暴力)
Chessboard Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what...原创 2018-04-10 19:00:17 · 294 阅读 · 0 评论 -
Codeforce960B(暴力贪心)
Minimize the error You are given two arrays A and B, each of size n. The error, E, between these two arrays is defined . You have to perform exactly k1 operations on array A and exactly k2 operations...原创 2018-04-10 20:41:56 · 188 阅读 · 0 评论 -
Codeforce962B(暴力)
Students in Railway Carriage There are n n consecutive seat places in a railway carriage. Each place is either empty or occupied by a passenger. The university team for the Olympiad consists of ...原创 2018-04-11 22:13:00 · 209 阅读 · 0 评论 -
Codeforce962B(二进制枚举暴力)
Make a Square 传送门 题意:给你一个数字(没有前导零),要求你删除一些数字,使得这个数字(不能有前导零)的平方根为整数。没有则输出-1. 思路:数字不大,二进制枚举每一种组合情况。 二进制枚举实现传送门 #include <iostream> #include <fstream> #include <cstdio> #includ...原创 2018-04-13 19:08:05 · 229 阅读 · 0 评论 -
Codeforce962D(暴力优先队列)
Merge Equals You are given an array of positive integers. While there are at least two equal elements, we will perform the following operation. We choose the smallest value x that occurs in the array...原创 2018-04-13 19:59:00 · 354 阅读 · 0 评论 -
hdu6351(暴力+技巧)---2018多校5
Beautiful Now 题目传送门 #include <iostream> #include <fstream> #include <cstdio> #include <cstring> #include <queue> #include <stack> #include <vector> #include原创 2018-08-07 15:32:07 · 960 阅读 · 0 评论 -
Longest Valid Parentheses(DP/思维)
32. Longest Valid Parentheses 传送门 dp思路: 问题->最长有效括号子序列长度 状态->dp[i]以i为结尾的最长有效括号子序列长度(则str[i]= ‘)’ ); 子状态: 如果str[i-1]= ‘(’ ---->dp[i-2] 如果str[i-1]= ‘)’ ---->如果str[i-dp[i-1]-1]= ‘(’ --...原创 2018-10-13 16:03:53 · 410 阅读 · 0 评论 -
Codeforce931C(思维)
Laboratory Work 传送门 题意:给你一个长为n的序列,该序列的元素之间的差值不超过二,现在要你找出一个新的大小同为n的序列,其平均数于原序列相等,并且里面的元素大小要在原序列的范围之内。 思路:要求大小为n,平均数相等,元素大小范围在原序列内,这说明要求在原序列中元素之间进行转化,而能转化的只有一种—a+1 + a+3 = 2*(a+2) 所以进行判断转化就可以了 ...原创 2018-03-14 20:59:00 · 166 阅读 · 0 评论 -
Codeforce919C(思维)
Seat Arrangements 题目传送门 题意:n*m个座位,按照矩阵排列,’.’表示没有人,’*’表示有人坐,让你找一排连续大小为k的座位,问有多少个。 #include #include #include #include #include #include #include #include #include #include #include #i原创 2018-02-01 15:00:45 · 237 阅读 · 0 评论 -
UVA - 11300(数学)
Spreading the WealthA Communist regime is trying to redistribute wealth in a village. They have have decided to sit everyone around a circular table. First, everyone has converted all of their properti原创 2017-09-22 20:26:54 · 221 阅读 · 0 评论 -
Codeforces 434 Div. 2 A
A. k-roundingtime limit per test1 secondFor a given positive integer n denote its k-rounding as the minimum positive integer x, such that x ends with k or more zeros in base 10 and is divisible by n.Fo原创 2017-09-18 19:31:49 · 387 阅读 · 0 评论 -
codeforce868c
Qualification RoundsSnark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty转载 2017-10-11 10:39:32 · 200 阅读 · 0 评论 -
codeforces876B
Divisiblity of DifferencesYou are given a multiset of n integers. You should select exactly k of them in a such way that the difference between any two of them is divisible by m, or tell that it is imp原创 2017-10-20 21:09:34 · 343 阅读 · 0 评论 -
uva11464(二进制枚举)
Even Parity题意:给你n*n的矩阵,上面的元素不是0就是1,现在要求你把一些0变成1,使得矩阵中每一个元素上下左右和(存在的话)加起来为偶数,求最少的操作数。思路:如果简单的暴力枚举的话会超时。我们可以枚举矩阵第一行的变化情况,然后往下推出下一行的变化情况(枚举每一个已知行的元素,如果当前元素不符合要求,查看该点下方是否可以从0变为1,不可以则这种方案不行,因为只有该点下方的那点在已知行外原创 2017-10-13 20:35:08 · 652 阅读 · 0 评论 -
ZOJ - 3993(思维)
Safest Buildings题目传送门 题意:吃鸡游戏,给出初始圈半径以及圈内的建筑,给你下一个圈的半径r(圈被要求在初始圈内),求最大概率为安全建筑的建筑有那几个。 思路:很简单可以知道,离中心越近越有可能,但事实上在某些范围内概率是相同的当r足够大或者足够小。我们把初始圈叫做大圆,下一个圈为小圆。当2*r大于R时,小圆内切大圆转一圈,可以发现以2*r-R为半径,以原圆心为圆心的圆内的点的原创 2017-11-01 19:57:34 · 939 阅读 · 0 评论 -
HDU - 5510(暴力)
Bazinga题目传送门#include <iostream> #include <fstream> #include <cstdio> #include <cstring> #include <queue> #include <stack> #include <vector> #include <map> #include <set> #include <cmath> #include <algo原创 2017-11-13 17:04:02 · 170 阅读 · 0 评论 -
CodeForces - 892C(gcd)
PrideYou have an array a with length n, you can perform operations. Each operation is like this: choose two adjacent elements from a, say x and y, and replace one of them with gcd(x, y), where gcd deno原创 2017-11-20 11:10:29 · 650 阅读 · 0 评论 -
CodeForces - 803C(GCD+思维)
Maximal GCD题目传送门 题意:给你两个数n,k。要你找一个严格连续递增数列,要求序列有k个元素,和为n并且gcd最大。 思路:很容易知道,要使得gcd最大,那么最大公约数必为数列首项,所以其最大公约数一定是n的因子。最好的情况为1d,2d,3d……,kd(d为最大公约数),即有 k*(k+1)/2 个d。因此,我们只需要求出n的因子,找到小于等于n/k*(k+1)/2中最大的因子就是最原创 2017-11-22 19:06:26 · 311 阅读 · 0 评论 -
Codeforce1062C(数学+快速幂)
#Banh-mi 传送门 ####思路:有题意可知在区间内取数的位置不影响结果,且要使得答案最大我们要从1开始取。 1 1 1 0 0 0 1] 2 2 1 1 1 2] 4 3 &原创 2018-11-17 20:30:27 · 325 阅读 · 0 评论