codechef MAY18 div2 部分题解

T1

https://www.codechef.com/MAY18B/problems/RD19

刚开始zz了,其实很简单。

删除一个数不会使gcd变小,于是就只有0/1两种情况

T2

https://www.codechef.com/MAY18B/problems/XORAGN

我们可以把B序列看做一个矩阵

那么$A(i,j)$和$A(j,i)$会抵消掉

因此答案就是$\sum_1^n A(i,i) + A(i,i)$

T3

https://www.codechef.com/MAY18B/problems/MTYFRI

答案的序列是固定的,因此后手会把自己最小的换做对手最大的,

贪心求解,两个堆维护最小最大值

T4

https://www.codechef.com/MAY18B/problems/DBFB

按照套路,考虑A,B对答案的贡献,A只可能作为第一项,B只可能作为第二项。

统计出斐波那契数列中A,B的出现次数

A,B会被枚举M次,因此答案最后乘M

T5

很有思维量的一道题

来不及写题解了,

弃坑。、

目前rank

顺便Orz zbq

原文地址:https://www.cnblogs.com/zwfymqz/p/8994189.html

时间: 2024-10-11 17:20:40

codechef MAY18 div2 部分题解的相关文章

codeforce 285 div2 D 题解

codeforce 285 div2 D 题解 说明 这道题目是看了思路分析才知道的,关键问题在于数据量过大,需要快速检索的同时不能辅助空间过大. 因此利用了下面3种方法结合解决该问题 康拓展开与逆康拓展开 树状数组 二分查找 代码 /** * @brief Codeforces Round #285 (Div. 2) d * @file d.cpp * @author mianma * @created 2015/01/27 18:18 * @edited 2015/01/29 22:45 *

Codechef Maximum Weight Difference题解

Maximum Weight Difference Chef has gone shopping with his 5-year old son. They have bought N items so far. The items are numbered from 1 to N, and the item i weighs Wi grams. Chef's son insists on helping his father in carrying the items. He wants hi

codechef - Bytelandian gold coins 题解

In Byteland they have a very strange monetary system. Each Bytelandian gold coin has an integer number written on it. A coin n can be exchanged in a bank into three coins: n/2, n/3 and n/4. But these numbers are all rounded down (the banks have to ma

codechef Ciel and Receipt题解

Tomya is a girl. She loves Chef Ciel very much. Tomya like a positive integer p, and now she wants to get a receipt of Ciel's restaurant whose total price is exactly p. The current menus of Ciel's restaurant are shown the following table. Name of Men

codechef The Lead Game 题解

The game of billiards involves two players knocking 3 balls around on a green baize table. Well, there is more to it, but for our purposes this is sufficient. The game consists of several rounds and in each round both players obtain a score, based on

codechef The Morning Commute 题解

The Morning Commute The Chef commutes to work every day using the city's underground metro. The schedule for the trains has recently been changed and he wants to know how long it will take to travel from the station nearest to his house and the stati

codechef Jewels and Stones 题解

Soma is a fashionable girl. She absolutely loves shiny stones that she can put on as jewellery accessories. She has been collecting stones since her childhood - now she has become really good with identifying which ones are fake and which ones are no

codechef Three Way Communications 题解

The Chef likes to stay in touch with his staff. So, the Chef, the head server, and the sous-chef all carry two-way transceivers so they can stay in constant contact. Of course, these transceivers have a limited range so if two are too far apart, they

Codechef Not a Triangle题解

找出一个数组中的三个数,三个数不能组成三角形. 三个数不能组成三角形的条件是:a + b < c 两边和小于第三边. 这个问题属于三个数的组合问题了.暴力法可解,但是时间效率就是O(n*n*n)了,很慢. 不过既然是组合问题就必定可以使用排序后处理的方法降低时间效率的. 这里降低时间效率的方法是: 选一个最大的数c,然后选两个小数a和b,其中a < b,如果符合条件,那么两个数中间的数必定都可以作为b符合条件a + b < c 这样可以把时间效率降到O(n*n). 这个规律也不好找啊.要