
贪心 || 思维 || bao力 || 模拟
Error Man
我是菜逼
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Gym 101889E. Enigma (dp => 思维)
题意: 有长度为最多为 1000位的大数,其中某些位是 ?,表示可以是 0 ~ 9 中的任意一个数. 给一个数 n,将所有的 ? 都填上,使得最后满足这个大数是 n 的倍数 (至少1倍),同时最小化这个大数 (不含前导 0)Analyse:容易想到的是 dp 做法。dp[i][j] 表示当前到第 i 位,mod n == j 的最小数,转移也并不复杂。但是问题来了,这个数是一个大数,存不下怎...原创 2019-10-23 23:03:59 · 231 阅读 · 0 评论 -
POJ - 2431 Expedition (贪心 + 优先队列 + 思维)
Expedition A group of cows grabbed a truck and ventured on an expedition deep into the jungle. Being rather poor drivers, the cows unfortunately managed to run over a rock and puncture the truck's...原创 2018-09-28 18:06:16 · 239 阅读 · 0 评论 -
HDU 6222 Heron and His Triangle ( 2017 ICPC沈阳, 线性递推 + 大数)
Heron and His TriangleA triangle is a Heron’s triangle if it satisfies that the side lengths of it are consecutive integers t−1, t, t+ 1 and thatits area is an integer. Now, for given n yo...原创 2018-09-23 15:31:38 · 577 阅读 · 0 评论 -
大数加,减,乘。纯模拟模板
大整数加法:char tmp[210]; /// addvoid bigadd(char *s,char *t){ int lens = strlen(s),lent = strlen(t); int xx[210] = {0}; int p = 0; while(lens > 0 && lent &g...原创 2018-09-22 23:16:13 · 222 阅读 · 0 评论 -
codeforces 1005D Polycarp and Div 3
Polycarp likes numbers that are divisible by 3.He has a huge number ss. Polycarp wants to cut from it the maximum number of numbers that are divisible by 33. To do this, he makes an arbitrary number...原创 2018-10-02 13:17:52 · 273 阅读 · 1 评论 -
2017 ICPC 南宁 ,Twice Equation (线性递推 + 大数)
Twice EquationFor given L, find the smallest n no smaller than L for which there exists an positive integer m for which 2m(m + 1) = n(n + 1).InputThis problem contains multiple test cases. The f...原创 2018-09-23 15:53:12 · 566 阅读 · 0 评论 -
CodeForces - 1040B Shashlik Cooking (贪心 + 细节)
Shashlik Cooking Long story short, shashlik is Miroslav's favorite food. Shashlik is prepared on several skewers simultaneously. There are two states for each skewer: initial and turned over.Thi...原创 2018-09-17 15:40:10 · 506 阅读 · 0 评论 -
CodeForces - 777C Alyona and Spreadsheet (暴力 ,预处理)
Alyona and SpreadsheetDuring the lesson small girl Alyona works with one famous spreadsheet computer program and learns how to edit tables.Now she has a table filled with integers. The table cons...原创 2018-08-25 21:06:15 · 239 阅读 · 0 评论 -
CodeForces - 780C Andryusha and Colored Balloons ( dfs )
Andryusha and Colored BalloonsAndryusha goes through a park each day. The squares and paths between them look boring to Andryusha, so he decided to decorate them.The park consists of n squares con...原创 2018-08-25 19:43:47 · 225 阅读 · 0 评论 -
CodeForces - 779C Dishonest Sellers (贪心)
Dishonest SellersIgor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week ...原创 2018-08-25 16:15:41 · 356 阅读 · 0 评论 -
CodeForces - 780B The Meeting Place Cannot Be Changed(二分大法!! 二分答案)
The Meeting Place Cannot Be ChangedDuring the lesson small girl Alyona works with one famous spreadsheet computer program and learns how to edit tables.Now she has a table filled with integers. Th...原创 2018-08-25 15:38:59 · 278 阅读 · 0 评论 -
CodeForces - 777B Game of Credit Cards(贪心)
Game of Credit CardsAfter the fourth season Sherlock and Moriary have realized the whole foolishness of the battle between them and decided to continue their competitions in peaceful game of Credit ...原创 2018-08-25 13:03:48 · 315 阅读 · 0 评论 -
CodeForces - 1005C Summarize to the Power of Two (贪心 + 离散化)
Summarize to the Power of TwoA sequence a1,a2,…,an is called good if, for each element ai, there exists an element aj (i≠j) such that ai+aj is a power of two (that is, 2d for some non-negative integ...原创 2018-09-28 19:33:31 · 349 阅读 · 0 评论 -
CodeForces - 1060B Maximum Sum of Digits (思维。)
B. Maximum Sum of DigitsYou are given a positive integer n.Let S(x) be sum of digits in base 10 representation of x, for example, S(123)=1+2+3=6, S(0)=0.Your task is to find two integers a,b, su...原创 2018-11-03 13:54:15 · 423 阅读 · 0 评论 -
HDU - 5935 Car (思维题)
CarRuins is driving a car to participating in a programming contest. As on a very tight schedule, he will drive the car without any slow down, so the speed of the car is non-decrease real number.Of ...原创 2019-09-17 15:03:39 · 372 阅读 · 0 评论 -
HDU 5976 Detachment (16 大连[铜],预处理 + 前缀积 + 费马小定理 + 贪心 + 二分)
DetachmentTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 4487 Accepted Submission(s): 1268Problem DescriptionIn a highly developed alien...原创 2019-09-15 21:11:10 · 219 阅读 · 0 评论 -
Codeforces 1200D. White Line(思维 + 前缀和)
戳我看题题意: 给一个字符矩阵,只含有 W 和 B,现在有一种操作,将一个 k * k 矩阵全部变为 W,问最多能有多少个行和列全部为 W思路: 可以单独算每一个点的贡献。以行为例:先算的每一行的 B 的前缀和,枚举这一行的所有点,若 prex[j+k−1]−prex[j−1]==prex[n] && prex[n]!=0prex[j ...原创 2019-09-07 21:10:32 · 270 阅读 · 0 评论 -
Codeforces 1154E.Two Teams(思维,两个set 直接艹)
Two Teams题目链接:点我看题题意: nnn 个人有编程能力 aia_iai,排成一行。两个教练 AAA 和 BBB,教练 AAA 先手,每一次选这一行中的最大编程能力的人,然后再向左右两选取 kkk 个人,不足 kkk 个则全部选取,选取了的人就离开。然后教练 BBB 做相同的操作。 输出 最后每个人属于的教练,AAA输出 111,BBB 输出 222.思路:考虑到每次都需要...原创 2019-08-30 16:22:57 · 368 阅读 · 0 评论 -
Codeforces 987 - C.Three displays(思维 + dp)
Three displaysIt is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.There ar...原创 2019-08-13 19:56:27 · 372 阅读 · 0 评论 -
洛谷 1417 (贪心 + 01背包)
题目背景由于你的帮助,火星只遭受了最小的损失。但gw懒得重建家园了,就造了一艘飞船飞向遥远的earth星。不过飞船飞到一半,gw发现了一个很严重的问题:肚子饿了~gw还是会做饭的,于是拿出了储藏的食物准备填饱肚子。gw希望能在T时间内做出最美味的食物,但是这些食物美味程度的计算方式比较奇葩,于是绝望的gw只好求助于你了。题目描述一共有n件食材,每件食材有三个属性,ai,bi和ci,...原创 2019-08-13 22:47:50 · 249 阅读 · 0 评论 -
Codeforces 940E. Cashback(贪心 + dp)
E. CashbackSince you are the best Wraith King, Nizhniy Magazin «Mir» at the centre of Vinnytsia is offering you a discount.You are given an array a of length n and an integer c.The value of some ar...原创 2019-08-20 17:49:02 · 332 阅读 · 0 评论 -
HDU 6693 Valentine's Day (技巧前缀和,前缀积)
Valentine’s DayProblem DescriptionOipotato loves his girlfriend very much. Since Valentine’s Day is coming, he decides to buy some presents for her.There are n presents in the shop, and Oipotato ca...原创 2019-08-23 23:33:30 · 290 阅读 · 0 评论 -
codeforces Educational Codeforces Round 64 (Rated for Div. 2) C (水题 暴力可过)
C. Match Pointstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a set of points x1, x2, ..., xn on the number line.Two points ...原创 2019-05-24 11:33:28 · 201 阅读 · 0 评论 -
贪心算法 之 最多区间调度问题
问题主题:区间调度问题 问题描述: 有n项工作,每项工作分别在si开始,ti结束。对每项工作,你都可以选择参加或不参加,但选择了参加某项工作就必须至始至终参加全程参与,即参与工作的时间段不能有重叠(即使开始的时间和结束的时间重叠都不行)。 限制条件: 1<=n<=100000 1<=si<=ti,=109 ...原创 2018-09-04 19:58:01 · 1273 阅读 · 0 评论 -
2019湖南多校第一场-20190310 I题
DescriptionToday the Intergalactic Council of Pebble Coins (ICPC) conducted an intergalactic auction of the Neutronium Chaos Pebble Coin (NCPC). This coin, which was forged in the Ancient Coin Mach...原创 2019-03-11 20:02:29 · 331 阅读 · 0 评论 -
CodeForces - 1008C Reorder the Array (思维)
Reorder the ArrayYou are given an array of integers. Vasya can permute (change order) its integers. He wants to do it so that as many as possible integers will become on a place where a smaller integ...原创 2018-11-12 20:10:54 · 224 阅读 · 0 评论 -
CodeForces - 1060C Maximum Subrectangle (前缀和 + 思维 + 暴力)
Maximum SubrectangleYou are given two arrays aa and bb of positive integers, with length nnand mm respectively.Let cc be an n×mn×m matrix, where ci,j=ai⋅bjci,j=ai⋅bj.You need to find a subrectan...原创 2018-11-14 17:25:47 · 501 阅读 · 0 评论 -
CodeForces - 776B Sherlock and his girlfriend (素数筛 + 思维)
Sherlock and his girlfriendSherlock has a new girlfriend (so unlike him!). Valentine's day is coming and he wants to gift her some jewelry.He bought n pieces of jewelry. The i-th piece has price e...原创 2018-08-25 12:43:48 · 279 阅读 · 0 评论 -
CodeForces - 777D Cloud of Hashtags (思维,水题)
Cloud of HashtagsVasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he ...原创 2018-08-25 12:17:09 · 320 阅读 · 0 评论 -
CodeForces - 886C Petya and Catacombs (思维)
A very brave explorer Petya once decided to explore Paris catacombs. Since Petya is not really experienced, his exploration is just walking through the catacombs.Catacombs consist of several rooms a...原创 2018-08-13 21:37:50 · 410 阅读 · 0 评论 -
CodeForces - 887B Cubes for Masha(暴力)
Cubes for Masha Absent-minded Masha got set of n cubes for her birthday.At each of 6 faces of each cube, there is exactly one digit from 0 to 9. Masha became interested what is the largest natur...原创 2018-08-13 21:21:28 · 326 阅读 · 0 评论 -
模和最大(贪心)
模和最大Description 有个数组a, 对于每个a[i],你要找到一个a[j] (i != j) ,使得 (a[i] + a[j]) % p最大。Input 输入第一行两个整数n,p。第二行n个整数a[i]。2 <= n <= 1e6.2 <= p <= 1e9.a[i] < p.Output 一行输出n个整数...原创 2018-08-08 20:23:14 · 427 阅读 · 0 评论 -
Gym - 101853J J - Smallest Difference(尺取法)
J - Smallest DifferenceYou are given an arrayaconsists ofnelements, find the maximum number of elements you can select from the array such that the absolute difference between any two of the cho...原创 2018-08-15 19:38:53 · 813 阅读 · 0 评论 -
Codeforces 922C - Cave Painting(思维 + 暴力)
Cave PaintingImp is watching a documentary about cave painting.Some numbers, carved in chaotic order, immediately attracted his attention. Imp rapidly proposed a guess that they are the remaind...原创 2018-08-12 13:47:30 · 576 阅读 · 0 评论 -
CodeForces - 817C Really Big Numbers(数学 + 二分, 二分大法好啊!!!)
Really Big Numbers .Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the diff...原创 2018-08-11 23:13:06 · 317 阅读 · 0 评论 -
Codeforces 817A - Treasure Hunt CodeForces(思维)
Treasure Hunt CodeForces Captain Bill the Hummingbird and his crew recieved an interesting challenge offer. Some stranger gave them a map, potion of teleportation and said that only this potion migh...原创 2018-08-11 20:47:34 · 355 阅读 · 0 评论 -
CodeForces - 814C C - An impassioned circulation of affection(尺取法)
C - An impassioned circulation of affectionNadeko's birthday is approaching! As she decorated the room for the party, a long garland of Dianthus-shaped paper pieces was placed on a prominent part of...原创 2018-08-14 21:20:41 · 174 阅读 · 0 评论 -
CodeForces 813B The Golden Age(暴力)
The Golden AgeUnlucky year in Berland is such a year that its number n can be represented as n = x^a + y^b, where a and b are non-negative integer numbers.For example, if x = 2 and y = 3 then the ...原创 2018-08-14 15:49:18 · 261 阅读 · 0 评论 -
Gym - 101864E E - Diverse Group(费马小定理求乘法逆元 求 组合数 取模 + 快速幂)
E - Diverse GroupIt’s the year 3018 and you are the head of the Bioinformation Articulation in Cosmic Space (BACS) program at NASA. Under this program, NASA has decided to send K humans to planet Na...原创 2018-08-14 12:37:51 · 312 阅读 · 0 评论 -
Gym - 101864A A Criminal (约瑟夫环 M = 2, + 暴力)
A CriminalAfter committing a serious crime ( Killing an innocent mosquito who never bites any animal) you are arrested by ACM’s Defense Team. You are the X-th (1 based index ) criminal in the ord...原创 2018-08-14 12:25:03 · 525 阅读 · 0 评论