Masha and Bears(翻译+思维)】的更多相关文章

Description A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into…
A. Masha and Bears time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car…
Problem description A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can cli…
Description You are given a rooted tree with n vertices. The vertices are numbered from 1 to n, the root is the vertex number 1. Each vertex has a color, let's denote the color of vertex v by cv. Initially cv = 0. You have to color the tree into the…
传送门 https://www.cnblogs.com/violet-acmer/p/10146350.html 题意: 有一块 n*m 的棋盘,初始,黑白块相间排列,且左下角为白块. 给出两个区间[ (x1,y1) , (x2,y2) ] 和 [ (x3,y3) , (x4,y4) ],第一个区间全部涂成白色,第二个区间全部涂成黑色,且颜色会覆盖. 求两块区间按照要求涂完后白块和黑快的个数? 题解: 我的想法如下: 先求出初始的黑块个数,然后,求出第一个区间减少的黑块个数,再求出第二个区间增加…
A. Masha and bears 题意 人的体积为\(V\),车的大小为\(size\),人能钻进车的条件是\(V\leq size\),人对车满意的条件是\(2V\geq size\). 现知道 熊爸爸能钻进最大的车并且满意 熊妈妈能钻进中等的车并且满意 熊宝宝能钻进最小的车并且满意 Masha能钻进最小的车并且只对它满意 给定四人的体积(保证\(V1\gt V2\gt V3\)),要求给出三辆车的大小. 思路 考思维严谨性的题.// 还是有些怕的 假设三辆车大小分别为\(a,b,c\),…
Masha and Bears Tic-Tac-Toe Shockers Seating of Students Party Power Tower Reverses…
题意 给你一棵树,q个询问(x,y,a,b,k),每次问你如果在(x,y)加一条边,那么a到b能不能走k步,同一个点可以走多次 思路(翻译题解) 对于一条a到b的最短路径x,可以通过左右横跳的方法把他扩大成任意的\(x+2i(i\geq 0)\),只要存在一个能使得它等于k的i即可.. 在这一题中,如果x和i连了边,那么就会存在三条可能的最短路径:(从哪到哪都是在原树上) 1.从a到b 2.从a到x,走加的边到y,从y到b 3.从a到y,走加的边到x,从x到b 判断是否存在满足就好了 代码 思路…
Codeforces 题目传送门 & 洛谷题目传送门 首先直接暴力枚举显然是不现实的,我们不妨换个角度来处理这个问题,考虑这 \(R_i\) 个瓶子中每一瓶被哪些熊在哪一天喝过. 我们考虑对这 \(R_i\) 个瓶子各建立一个 \(q\times n\) 的 01 矩阵,第 \(j\) 行第 \(k\) 列为 \(1\) 表示第 \(k\) 只熊在第 \(j\) 天尝过了这瓶酒,反之第 \(k\) 只熊在第 \(j\) 天尝过了这瓶酒. 那么题目中的条件可表示为: 每一个表格里 \(1\) 的个…
原题链接 Problem - 1523B - Codeforces 题目及部分翻译 While trading on(贸易,利用) his favorite exchange trader William realized that he found a vulnerability( [ˌvʌlnərəˈbɪləti] n.易损性:弱点). Using this vulnerability he could change the values of certain internal variab…