随笔分类 - 算法基础—贪心
摘要:Problem Description Zhang3 is playing a shooting game with Father. In the game there are two players trying to kill each other to win the game. The ga
阅读全文
摘要:Tokitsukaze has a sequence of length n, denoted by a . Tokitsukaze can merge two consecutive elements of a as many times as she wants. After each oper
阅读全文
摘要:Given a string P consisting of only parentheses and asterisk characters (i.e. "(", ")" and ""), you are asked to replace all the asterisk characters i
阅读全文
摘要:#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 >
阅读全文
摘要:https://www.jisuanke.com/contest/11360/challenges 其他题慢慢补 C. Pawn‘s Revenge You are playing a special chess game against a professor and you've almost
阅读全文
摘要:Vladimir would like to prepare a present for his wife: they have an anniversary! He decided to buy her exactly nn flowers. Vladimir went to a flower s
阅读全文
摘要: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
阅读全文
摘要:There are nn programmers that you want to split into several non-empty teams. The skill of the ii -th programmer is aiai . You want to assemble the ma
阅读全文
摘要: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
阅读全文
摘要:好,好难 https://ac.nowcoder.com/acm/contest/5477 A. 题目描述 天才程序员菜哭武和张老师有一天到一个城市旅游,旅途中菜哭武觉得无聊就想和张老师玩一个游戏。菜哭武有n个石子,每个石子都标有1到n之间到数,且各不相同,一开始他们会随机从这堆石子选一个石子放置到
阅读全文
摘要:Ashish has a tree consisting of nn nodes numbered 11 to nn rooted at node 11 . The ii -th node in the tree has a cost aiai , and binary digit bibi is
阅读全文
摘要: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
阅读全文
摘要:Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus. She has
阅读全文
摘要:You are given a string ss such that each its character is either 1, 2, or 3. You have to choose the shortest contiguous substring of ss such that it c
阅读全文
摘要:Young wilderness explorers set off to their first expedition led by senior explorer Russell. Explorers went into a forest, set up a camp and decided t
阅读全文
摘要: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
阅读全文
摘要:Writing light novels is the most important thing in Linova's life. Last night, Linova dreamed about a fantastic kingdom. She began to write a light no
阅读全文
摘要:Kana was just an ordinary high school girl before a talent scout discovered her. Then, she became an idol. But different from the stereotype, she is a
阅读全文
摘要:题目描述 You are given three positive integers n n n , a a a and b b b . You have to construct a string s s s of length n n n consisting of lowercase Lati
阅读全文
摘要:You have an array aa of length nn . For every positive integer xx you are going to perform the following operation during the xx -th second: Select so
阅读全文