![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
贪心
GUESSERR
这个作者很懒,什么都没留下…
展开
-
抽王八 CCUT Online Judge (运算符模板题)
抽王八描述 本题不同版本之间唯一的区别就是数据范围。 “抽王八”是一种简单有趣的扑克牌游戏,要玩这个游戏,需要准备若干张扑克牌。我们今天使用的扑克牌比较特殊,没有花色,只有数字,每张牌上都写着一个正整数,最小为1,最大为10⁹,并且每种牌都有无限张。参与游戏的玩家需要至少两个人,人数没有上限。这个游戏的准备步骤如下:首先,牌堆初始为空。选定一个正整数 p(1≤ p ≤10⁹)。向牌堆里加入 x 张写着正整数 p 的扑克牌,其中 x 为任意一个大于 0 的偶数。重复 2 到 3 ,直到觉原创 2020-12-07 13:33:15 · 1274 阅读 · 2 评论 -
二八定律(优先队列+贪心)
二八定律(优先队列+贪心)描述 你听说过“二八定律”吗?经济学家发现,社会上80%的财富都被20%的人占据了,说明“少数有时候更重要”。今天我们要做的题就和这个定律相关。给你一个长度为 n 的由非负整数构成的数列 A,你可以删除 0 个或任意多个元素,保持其余元素顺序不变,形成一个子序列 B。问你能否通过这样的方法得到一个长度至少为5的子序列 B,使得 B 的前 20% 项(向下取整)之和不小于 B 所有项之和的 80%? 换句话说,设 B 的长度为 k,B 的元素编号从 1 到 k ,则原创 2020-11-29 23:22:39 · 301 阅读 · 0 评论 -
Beauty Values (2020ICPC·小米 网络选拔赛热身赛 贪心)
Beauty Values时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 524288K,其他语言1048576K64bit IO Format: %lld题目描述 Gromah and LZR have entered the second level. There is a sequence a1,a2,a3……an on the wall. There is also a note board saying “the beauty value of a sequence原创 2020-10-24 20:02:36 · 276 阅读 · 0 评论 -
牛客练习赛68 牛牛的mex
牛牛的mex时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 524288K,其他语言1048576K64bit IO Format: %lld题目描述 牛牛现在有一个长度为 n 的序列 a1,a2, …,an。现在牛牛有 q 次询问,每次想询问区间 [l,r]的 mex 是什么。 一个序列的 mex 定义为最小未出现的自然数。输入描述: 第一行两个整数 n,q 表示序列长度和询问次数。 接下来一行 n 个非负整数,表示序列 ai。 接下来 q 行,每行两个整数原创 2020-08-29 17:36:35 · 779 阅读 · 0 评论 -
L2-015 互评成绩 (25分)
L2-015 互评成绩 (25分)用到了一些新函数,记录一下#include<iostream>#include <cstdio>#include <cmath>#include <cstring>#include <string>#include <cmath>#include <stack>#include <queue>#include <vector>#include &原创 2020-08-15 09:50:22 · 144 阅读 · 0 评论 -
Codeforces Round #659 (Div. 2) A. Common Prefixes
A. Common Prefixestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe length of the longest common prefix of two strings s=s1s2…sn and t=t1t2…tm is defined as the maximum integer k (0≤k≤min(n,m)) su原创 2020-07-29 18:34:09 · 107 阅读 · 0 评论 -
Educational Codeforces Round 67 (Rated for Div. 2) B. Letters Shop
B. Letters ShopThe letters shop showcase is a string s, consisting of n lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the ...原创 2019-07-01 20:04:04 · 277 阅读 · 0 评论 -
Educational Codeforces Round 67 (Rated for Div. 2) C. Vasya And Array
C. Vasya And ArrayVasya has an array a1,a2,…,an.You don’t know this array, but he told you m facts about this array. The i-th fact is a triple of numbers ti, li and ri (0≤ti≤1,1≤li<ri≤n) and it m...原创 2019-07-01 19:59:52 · 249 阅读 · 0 评论 -
POJ Stall Reservations
Stall ReservationsTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 13708 Accepted: 4815 Special Judge DescriptionOh those picky N (1 <= N <= 50,000) cows! They are so picky th...原创 2019-06-11 20:13:40 · 202 阅读 · 0 评论 -
OpenJudge 1328:Radar Installation
1328:Radar Installation总时间限制: 1000ms 内存限制: 65536kB描述Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating in the...原创 2019-06-15 20:17:32 · 389 阅读 · 0 评论 -
Codeforces Round #568 (Div. 2) C2. Exam in BerSU (hard version)
C2. Exam in BerSU (hard version)The only difference between easy and hard versions is constraints.If you write a solution in Python, then prefer to send it in PyPy to speed up execution time.A sess...原创 2019-06-20 02:36:19 · 440 阅读 · 0 评论 -
Codeforces Round #563 (Div. 2) 1174B . Ehab Is an Odd Person
B. Ehab Is an Odd Persontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou're given an array a of length n. You can perform the following ope...原创 2019-06-04 00:19:04 · 335 阅读 · 0 评论 -
Educational Codeforces Round 65 (Rated for Div. 2) A. Telephone Number
A telephone number is a sequence of exactly 11 digits, where the first digit is 8. For example, the sequence 80011223388 is a telephone number, but the sequences 70011223388 and 80000011223388 are not...原创 2019-05-16 00:43:15 · 120 阅读 · 0 评论 -
B. Expansion coefficient of the array
Let’s call an array of non-negative integers a1,a2,…,an a k-extension for some non-negative integer k if for all possible pairs of indices 1≤i,j≤n the inequality k⋅|i−j|≤min(ai,aj) is satisfied. The e...原创 2019-05-13 00:31:51 · 166 阅读 · 3 评论 -
A - A pile of stones
Vasya has a pile, that consists of some number of stones. n times he either took one stone from the pile or added one stone to the pile. The pile was non-empty before each operation of taking one ston...原创 2019-05-13 00:35:14 · 524 阅读 · 0 评论 -
Codeforces Round #562 (Div. 2) 1169B. Pairs
B. Pairstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputToad Ivan has m pairs of integers, each integer is between 1 and n, inclusive. The pa...原创 2019-05-28 20:02:00 · 528 阅读 · 0 评论 -
Codeforces Round#566(Div.2)1182C. Beautiful Lyrics
C. Beautiful Lyricstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given n words, each of which consists of lowercase alphabet letters...原创 2019-06-13 12:13:38 · 354 阅读 · 0 评论 -
Codeforces Global Round 3 1148A. Another One Bites The Dust
A. Another One Bites The Dusttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLet's call a string good if and only if it consists of only two t...原创 2019-06-02 10:39:53 · 194 阅读 · 0 评论 -
Codeforces Round #564 (Div. 2) 1173C. Nauuo and Cards
C. Nauuo and Cardstime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputNauuo is a girl who loves playing cards.One day she was playing cards bu...原创 2019-06-08 19:25:21 · 279 阅读 · 0 评论 -
Codeforces Round #563 (Div. 2) 1174A. Ehab Fails to Be Thanos
A. Ehab Fails to Be Thanosime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou're given an array a of length 2n. Is it possible to reorder it in...原创 2019-06-04 00:11:14 · 191 阅读 · 0 评论 -
A. Remainder
You are given a huge decimal number consisting of n digits. It is guaranteed that this number has no leading zeros. Each digit of this number is either 0 or 1.You may perform several (possibly zero) ...原创 2019-05-15 19:13:22 · 491 阅读 · 2 评论