
CF#484 Div2 D. SharkFor long time scientists study the behavior of sharks. Sharks, as many other species, alternate short movements in a certain location and long movements between locations. Max is a young biologist. For n" datamcetabindex="0">nn days he watched a specific shark, and now he knows the di

CF#488 Div2 E. Careful ManeuveringThere are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a twodimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y" datamcetabindex="0">yycoordinates, and their x" datamcetabindex=

CF#484 Div.2 E. Billiardtime limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Consider a billiard table of rectangular size n×m" datamcetabindex="0">n×mn×m with four pockets. Let's introduce a coordinate system with the origin at th

CF988E Divisibility by 25题目描述You are given an integer n from 11 to 10^{18} without leading zeroes. In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have ca解题记录 Codeforces 131 0 0

CF#470 Div2 B. Primal SportAlice and Bob begin their day with a quick game. They first choose a starting number X0 ≥ 3 and try to reach one million by the process described below. Alice goes first and then they take alternating turns. In the ith turn, the player whose turn it is selects a prime number smaller than the curr

CF#470 Div2 D. Perfect SecurityAlice has a very important message M consisting of some nonnegative integers that she wants to keep secret from Eve. Alice knows that the only theoretically secure cipher is onetime pad. Alice generates a random key K of the length equal to the message's length. Alice co

Codeforces 911D Inversion Counting题目蓝链 Description A permutation of size n is an array of size n such that each integer from 1 to n occurs exactly once in this array. An inversion in a permutation p is a pair of indices (i, j) such that i > j and ai < aj. For example, a permutation [4, 1, 3, 2] contains 4 inversions: (2,

Codeforces 915D Almost Acyclic Graph题目蓝链 Description You are given a directed graph consisting of n vertices and m edges (each edge is directed, so it can be traversed in only one direction). You are allowed to remove at most one edge from it. Can you make this graph acyclic by removing at most one edge from it? A directed gra

Codeforces 915C Permute Digits题目蓝链 Description You are given two positive integer numbers a and b. Permute (change order) of the digits of a to construct maximal number not exceeding b. No number in input and/or output can start with the digit 0. It is allowed to leave a as it is. Input The first line contains i

CF#259 Div1 A Little Pony and Expected MaximumTwilight Sparkle was playing Ludo with her friends Rainbow Dash, Apple Jack and Flutter Shy. But she kept losing. Having returned to the castle, Twilight Sparkle became interested in the dice that were used in the game. The dice has m faces: the first face of the dice contains a dot, the