随笔分类 - 算法基础—思维题
摘要:You are given an array aa consisting of nn positive integers. Find a non-empty subset of its elements such that their sum is even (i.e. divisible by 2
阅读全文
摘要:Tanya wants to go on a journey across the cities of Berland. There are nn cities situated along the main railroad line of Berland, and these cities ar
阅读全文
摘要:Polycarp is preparing the first programming contest for robots. There are nn problems in it, and a lot of robots are going to participate in it. Each
阅读全文
摘要:Tired of boring office work, Denis decided to open a fast food restaurant. On the first day he made aa portions of dumplings, bb portions of cranberry
阅读全文
摘要:Bessie the cow has just intercepted a text that Farmer John sent to Burger Queen! However, Bessie is sure that there is a secret message hidden inside
阅读全文
摘要:Ayoub thinks that he is a very smart person, so he created a function f(s)f(s) , where ss is a binary string (a string which contains only symbols "0"
阅读全文
摘要:Dark is going to attend Motarack's birthday. Dark decided that the gift he is going to give to Motarack is an array aa of nn non-negative integers. Da
阅读全文
摘要:You are given three strings aa , bb and cc of the same length nn . The strings consist of lowercase English letters only. The ii -th letter of aa is a
阅读全文
摘要:Your company was appointed to lay new asphalt on the highway of length nn. You know that every day you can either repair one unit of the highway (lay
阅读全文
摘要:You are given a string ss. Each character is either 0 or 1. You want all 1's in the string to form a contiguous subsegment. For example, if the string
阅读全文
摘要:Guy-Manuel and Thomas have an array aa of nn integers [a1,a2,…,an ]. In one step they can add 11 to any element of the array. Formally, in one step th
阅读全文
摘要:Mishka wants to buy some food in the nearby shop. Initially, he has ss burles on his card. Mishka can perform the following operation any number of ti
阅读全文
摘要:You are given an array aa consisting of nn integers. In one move, you can choose two indices 1≤i,j≤n1≤i,j≤n such that i≠ji≠j and set ai:=ajai:=aj . Yo
阅读全文