随笔分类 - 算法基础—思维题
摘要:During the quarantine, Sicromoft has more free time to create the new functions in "Celex-2021". The developers made a new function GAZ-GIZ, which inf
阅读全文
摘要:Petya and Vasya are competing with each other in a new interesting game as they always do. At the beginning of the game Petya has to come up with an a
阅读全文
摘要:You are given two integers nn and mm . You have to construct the array aa of length nn consisting of non-negative integers (i.e. integers greater than
阅读全文
摘要:Phoenix has decided to become a scientist! He is currently investigating the growth of bacteria. Initially, on day 11, there is one bacterium with mas
阅读全文
摘要:Phoenix has nn coins with weights 21,22,…,2n21,22,…,2n. He knows that nn is even. He wants to split the coins into two piles such that each pile has e
阅读全文
摘要:题目描述 You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here. The picture showing the
阅读全文
摘要:You have integer nn. Calculate how many ways are there to fully cover belt-like area of 4n−24n−2 triangles with diamond shapes. Diamond shape consists
阅读全文
摘要:You are given a complete directed graph KnKn with nn vertices: each pair of vertices u≠vu≠v in KnKn have both directed edges (u,v)(u,v) and (v,u)(v,u)
阅读全文
摘要:output standard output Polycarp has recently created a new level in this cool new game Berlio Maker 85 and uploaded it online. Now players from all ov
阅读全文
摘要:Alice has a cute cat. To keep her cat fit, Alice wants to design an exercising walk for her cat! Initially, Alice's cat is located in a cell (x,y)(x,y
阅读全文
摘要:Problem Statement Snuke has decided to play a game using cards. He has a deck consisting of NN cards. On the ii -th card from the top, an integer AiAi
阅读全文
摘要:The round carousel consists of nn figures of animals. Figures are numbered from 11 to nn in order of the carousel moving. Thus, after the nn -th figur
阅读全文
摘要:For the given integer nn (n>2n>2 ) let's write down all the strings of length nn which contain n−2n−2 letters 'a' and two letters 'b' in lexicographic
阅读全文
摘要:You are given two positive integers aa and bb. In one move you can increase aa by 11 (replace aa with a+1a+1). Your task is to find the minimum number
阅读全文
摘要:Petya has a rectangular Board of size n×mn×m . Initially, kk chips are placed on the board, ii -th chip is located in the cell at the intersection of
阅读全文
摘要:You are given two integers nn and kk. Your task is to find if nn can be represented as a sum of kk distinct positive odd (not divisible by 22) integer
阅读全文
摘要:You are given a tree consisting of nn nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is
阅读全文
摘要:You are given a positive integer xx . Find any such 22 positive integers aa and bb such that GCD(a,b)+LCM(a,b)=xGCD(a,b)+LCM(a,b)=x . As a reminder, G
阅读全文
摘要:You are given an array a1,a2,…,ana1,a2,…,an . Array is good if for each pair of indexes i<ji<j the condition j−aj≠i−aij−aj≠i−ai holds. Can you shuffle
阅读全文
摘要:You are given two integers nn and mm (m<nm<n). Consider a convex regular polygon of nn vertices. Recall that a regular polygon is a polygon that is eq
阅读全文