随笔分类 -  Codeforces

摘要:Examples input Copy 31 21 3 output Copy 0 input Copy 51 22 33 44 5 output Copy 2 Note Tree definition: https://en.wikipedia.org/wiki/Tree_(graph_theor 阅读全文
posted @ 2020-04-18 23:35 AlexLIN· 阅读(204) 评论(0) 推荐(0)
摘要:You are given n magical numbers a 1, a 2, ..., a n, such that the length of each of these numbers is 20 digits. You can move from the i th number to t 阅读全文
posted @ 2020-04-18 16:34 AlexLIN· 阅读(166) 评论(0) 推荐(0)
摘要:You are given an array a consisting of n integers. A subarray (l, r) from array a is defined as non-empty sequence of consecutive elements al, al + 1, 阅读全文
posted @ 2020-04-17 00:55 AlexLIN· 阅读(261) 评论(0) 推荐(0)
摘要:An anagram is a word or phrase formed by rearranging the letters of another word or phrase, using all the original letters exactly once, such as "post 阅读全文
posted @ 2020-04-16 16:56 AlexLIN· 阅读(243) 评论(0) 推荐(0)
摘要:题意: 一开始所有点都是花园 1为首都(即根) 现在n个点里弄k个工厂,而密探都在工厂点上 密探回首都时每经过一个花园时幸福度+1 密探一定走最短路 问最大幸福度之和 思路:BFS求出每个节点的深度,然后再减掉每个节点儿子所做的贡献,思路在代码中(DFS更简单) 代码: #include <iost 阅读全文
posted @ 2020-04-16 11:59 AlexLIN· 阅读(212) 评论(0) 推荐(0)
摘要:Output For each test case, print a single line containing the number of unique subarrays OR values among the subarray OR values of all subarrays in th 阅读全文
posted @ 2020-04-15 18:23 AlexLIN· 阅读(190) 评论(0) 推荐(0)
摘要:题目描述Kayaking is playing a puzzle game containing n different blocks. He marks the blocks with integers from 1 to n, which show the blocks’ original po 阅读全文
posted @ 2020-04-15 16:28 AlexLIN· 阅读(192) 评论(0) 推荐(0)
摘要:小希到了大学,发现宿舍里有很多蟑螂,蟑螂有两种颜色:红色和黑色 他把宿舍里的蟑螂排成一排,一共n只,小希想让他们变成颜色交替。 每次操作可以为:一、将一只蟑螂染成另一种颜色,二、交换两个蟑螂的位置 小希没有带电脑,他请你帮忙计算一下,最少需要操作几次才能形成颜色交替的一排蟑螂 Input 第一行一个 阅读全文
posted @ 2020-04-15 01:03 AlexLIN· 阅读(208) 评论(0) 推荐(0)