ACM思维题训练集合 There is a board with a grid consisting of n rows and m columns, the rows are numbered from 1 from top to bottom and the columns are numbered from 1 from left to right. In this grid we will denote the cell that lies on row number i and col…
cf 443 D. Teams Formation(细节模拟题) 题意: 给出一个长为\(n\)的序列,重复\(m\)次形成一个新的序列,动态消除所有k个连续相同的数字,问最后会剩下多少个数(题目保证消除的顺序对答案不会造成影响) \(n <= 10^{5} ,m <= 10^{9} ,k <= 10^{9},a_i <= 10^{5}\) 思路: 直接上题解好了 首先要用栈预处理序列本身,然后考虑处理后的序列 比较头和尾是否能够消除,细节需要处理好. #include<bi…
codeforces 407 div1 B题(Weird journey) 传送门 题意: 给出一张图,n个点m条路径,一条好的路径定义为只有2条路径经过1次,m-2条路径经过2次,图中存在自环.问满足条件的路径数 题解: 推论:对于一条边u-->v,我们将其选作为那两条边之一,那么剩下一条边必然与之相邻或者是自环,因为这样才能满足这两条边只走1次. 那么这条边的贡献值为这条边的相邻边数+自环数,假如这条边本身为自环,那么由于剩下的边可以任选(前一个推论),贡献值为m-1 这个AC时间很6啊23…
codeforces 407 div1 A题(Functions again) Something happened in Uzhlyandia again... There are riots on the streets... Famous Uzhlyandian superheroes Shean the Sheep and Stas the Giraffe were called in order to save the situation. Upon the arriving, the…
什么是老板思维,什么是员工思维,深有体会,最近被N个行业洗脑………
随着思维导图的流行,与其相关的思维导图制作软件如雨后春笋,纷纷进入我们的视野中,更让人难以选择.那想要入门的萌新该如何开始这个新的旅途呢? 各式各样的思维导图制作软件当中,有一个软件得到了大家一致的好评,它就是iMindMap 11(Windows系统).iMindMap思维导图用法较为简单,对于新手入门来说,是个很不错的选择. 特别的是,我发现了两个快速制作完成一幅思维导图的iMindMap思维导图用法. 一.直接使用模板 1. iMindMap思维导图用法一,在左上角的"文件"选项…
题目:http://codeforces.com/contest/374/problem/A 题意:求到达边界的最小步数.. 刚开始以为是 bfs,不过数据10^6太大了,肯定不是... 一个思维题,要注意超边界... #include <iostream> #include <cstring> #include <algorithm> using namespace std; <<); int n,m,x,y,a,b; int ok(int x1,int…
题目地址:24道CF的DIv2 CD题有兴趣可以做一下. ACM思维题训练集合 Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another snow drift. He ha…
Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are n commodities produced by the company. For each of them there is exactly one integer in the final report, that denotes correspond…
ACM思维题训练集合 After passing a test, Vasya got himself a box of n candies. He decided to eat an equal amount of candies each morning until there are no more candies. However, Petya also noticed the box and decided to get some candies for himself. This me…
ACM思维题训练集合 Desciption You've got an n × m pixel picture. Each pixel can be white or black. Your task is to change the colors of as few pixels as possible to obtain a barcode picture. A picture is a barcode if the following conditions are fulfilled: A…
ACM思维题训练集合 A bracket sequence is a string, containing only characters "(", ")", "[" and "]". A correct bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting…
ACM思维题训练集合 You've got an array a, consisting of n integers. The array elements are indexed from 1 to n. Let's determine a two step operation like that: First we build by the array a an array s of partial sums, consisting of n elements. Element number…
ACM思维题训练集合 To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers…
ACM思维题训练集合 The Bytelandian Institute for Biological Research (BIBR) is investigating the properties of two species of bacteria, named simply 0 and 1. Even under a microscope, bacteria of those two species are very difficult to distinguish. In fact, t…
https://vjudge.net/problem/2135388/origin Describe You are given an integer sequence 1,2,-,n. You have to divide it into two sets A and B in such a way that each element belongs to exactly one set and |sum(A)−sum(B)| is minimum possible. The value |x…
ACM思维题训练集合 Furik and Rubik love playing computer games. Furik has recently found a new game that greatly interested Rubik. The game consists of n parts and to complete each part a player may probably need to complete some other ones. We know that the…
题意: 给你01字符串的长度再给你一个串. 然后你可以在这个串中选择一个起点和一个终点使得这个连续区间内所有的位取反. 求: 经过处理后最多会得到多少次01变换. 例如:0101是4次,0001是2次,000110是3次. 分析: 区间内部的数目是不会发生变化的,因为每一位都是按位取反,相当于都没变,唯一发生变化的是区间边缘,所以考虑到连续的两个或多个1或者0的时候在其中某处设置断点会使得变换次数增加,很容易理解当某处有两个连续点的时候变换次数增加1,因为一个区间只有两个端点所以变换次数最多增加…
题目链接:http://codeforces.com/problemset/problem/1038/D 题意: 给出 $n$ 个史莱姆,每个史莱姆有一个价值 $a[i]$,一个史莱姆可以吃掉相邻的史莱姆,此时其自身的价值就要减掉被吃掉的那个史莱姆的价值. 史莱姆会不断的互相吞噬直到最后只剩一个,要求你该史莱姆可能的最大价值. 题解: 相当于你在 $n$ 个数前面添加 $+$ 或者 $-$,然后拼成一个算式计算答案. 首先考虑到的是,史莱姆的价值是全正或者全负的情况,这样的话,不可能使得所有价值…
Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game. Initially you have a sequence of n integers: 1, 2, ..., n. In a single step, you can pick two of them, let's denote them a and …
Little Artem is fond of dancing. Most of all dances Artem likes rueda — Cuban dance that is danced by pairs of boys and girls forming a circle and dancing together. More detailed, there are n pairs of boys and girls standing in a circle. Initially, b…
Nastya received a gift on New Year - a magic wardrobe. It is magic because in the end of each month the number of dresses in it doubles (i.e. the number of dresses becomes twice as large as it is in the beginning of the month). Unfortunately, right a…
D. Vladik and Favorite Game time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output This is an interactive problem. Vladik has favorite game, in which he plays all his free time. Game field could…
Welcoming autumn evening is the best for walking along the boulevard and npeople decided to do so. The boulevard can be represented as the axis Ox. For every person there are three parameters characterizing the behavior: ti, si, fi — the moment of ti…
Sonya and Robots time limit per test 1 second memory limit per test 256 megabytes input: standard input output: standard output Since Sonya is interested in robotics too, she decided to construct robots that will read and recognize numbers. Sonya has…
Kevin has just recevied his disappointing results on the USA Identification of Cows Olympiad (USAICO) in the form of a binary string of length n. Each character of Kevin's string represents Kevin's score on one of the n questions of the olympiad-'1' …
Neko Performs Cat Furrier TransformCodeForces - 1152B 题目大意:给你一个x,在40步操作以内把x变成2m−1,m为非负整数.对于每步操作,奇数步可以在(0<=n<=30)中挑选一个n,将x⊕(2n−1),而偶数步将x++.输出操作步数,以及在每个奇数步异或的n,多个答案,输出任一答案,保证至少有一个答案. 一开始傻逼了,真的照题意所说的去写了一个深搜,果断超时了.其实每个奇数步也是异或一个二进制全1的数,那我们就直接把x尾部连续0部分,全部…
题目链接 参考代码: #include <iostream> using namespace std; int main() { ; int n; cin >> n; ; i <= n; i ++) { ans += i * (i - ); } cout << ans << endl; ; }…
You are given qq queries in the following form: Given three integers lili, riri and didi, find minimum positive integer xixi such that it is divisible by didi and it does not belong to the segment [li,ri][li,ri]. Can you answer all the queries? Recal…
题意:给出n(0≤n≤22)和m,和m个数ai,1 ≤ m ≤ 2n ,0≤ai<2n ,把ai & aj == 0 的连边,求最后有几个连通块 解析:一个一个去找肯定爆,那么就要转换一下思维,想一下什么样的数才能按位与ai为0 那么肯定是ai ^ ((1<<n)-1)的子集,所以去找它的所有子集即可 例1010  变成0101  子集有 0101  0100  0001 然后只有x是给出的那m个数种的时候 才能 ^ ,其他情况消1取子集 #include <bits/st…