随笔分类 - 算法基础—思维题
摘要:Today is Jaime’s birthday and, to celebrate, his friends ordered a cake decorated with eggfruits and persimmons. When the cake arrived, to their surpr
阅读全文
摘要:You are given an array a consisting of n integers numbered from 1to n . Let's define the k -amazing number of the array as the minimum number that occ
阅读全文
摘要:You are given a binary string s consisting of n zeros and ones. Your task is to divide the given string into the minimum number of subsequences in suc
阅读全文
摘要:You have n gifts and you want to give all of them to children. Of course, you don't want to offend anyone, so all gifts should be equal between each o
阅读全文
摘要:Problem Description You are given two 10-based integers b and x, and you are required to determine the following proposition is true or false: For arb
阅读全文
摘要:The length of the longest common prefix of two strings and is defined as the maximum integer k0≤k≤min*(n,*m)) such
阅读全文
摘要:Zhang3 a participant of IPhO (Immortal Physics Olympiad). The problem in the contest is as follows. There are two balls that weigh k
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; int a[1005][1005] = {0}, n, m; int main() { int t; cin >> t; while(t--) { memset(a, 0, sizeof(a)); cin >
阅读全文
摘要:Problem Description S is a string of length n. S consists of lowercase English alphabets. Your task is to count the number of different S with the min
阅读全文
摘要:You are given three positive (i.e. strictly greater than zero) integers xx , yy and zz . Your task is to find positive integers aa , bb and cc such th
阅读全文
摘要:Cuber QQ 长期在网络上与他人对线,一天,他发明了一台神奇的打字机。这台打字机只能处理由 a,b,X 构成的字符串。具体来说,打字机能够执行如下三种操作。 • 操作1:将任意一个 X 替换为 aX 。 • 操作2:将任意一个 X 替换为 aXbX 。 • 操作3:删除任意一个 X 。 打字机启
阅读全文
摘要:B. 与矩阵 单点时限: 1.0 sec 内存限制: 512 MB 前有牛顿瘟疫“家里蹲”发明微积分。 现有 Cuber QQ 新冠肺炎“家里蹲”发明与矩阵。 与矩阵是一个 n×n 的矩阵。规定矩阵中的第 i 行第 j 列记为 (i,j) 。 生成一个与矩阵的方式是,先生成一个长度为 n 的数列 a
阅读全文
摘要:Tom and Jerry are going on a vacation. They are now driving on a one-way road and several cars are in front of them. To be more specific, there are nn
阅读全文
摘要:Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string s=s1s2…sns
阅读全文
摘要:Patrick likes to play baseball, but sometimes he will spend so many hours hitting home runs that his mind starts to get foggy! Patrick is sure that hi
阅读全文
摘要:The last contest held on Johnny's favorite competitive programming platform has been received rather positively. However, Johnny's rating has dropped
阅读全文
摘要:Johnny has recently found an ancient, broken computer. The machine has only one register, which allows one to put in there one variable. Then in one o
阅读全文
摘要:Ayush and Ashish play a game on an unrooted tree consisting of nn nodes numbered 11 to nn. Players make the following move in turns: Select any leaf n
阅读全文
摘要:Shubham has a binary string ss. A binary string is a string containing only characters "0" and "1". He can perform the following operation on the stri
阅读全文
摘要:A. Odd Selection time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Shubham has an array aa
阅读全文