![](https://img-blog.csdnimg.cn/20190830103041432.jpg?x-oss-process=image/resize,m_fixed,h_224,w_224)
🐖贪心+思维+二分+搜索+枚举算法
文章平均质量分 75
再见
风骨散人Chiam
我叫风骨散人Chiam,名字的意思是向往可以不低头的自由生活,可现实却不是这样,希望同样被生活绑架的你,可以通过自己的努力改变现状。目前在中国科学院攻读研究生,研究方向是网络安全和控制访问,热爱编程,热爱技术,喜欢分享,知识无界,希望我的分享可以帮到你!
如果有什么想看的,可以私信我,如果在能力范围内,我会发布相应的博文!
感谢大家的阅读!你的点赞、收藏、关注是对我最大的鼓励!
在CSDN没什么收益,博主已经没有动力继续更新技术文章了,已经准备跑路了,大家如果想了解我的更改情况就去我的主页看看。
展开
-
『ACM-算法-枚举法』信息竞赛进阶指南--枚举方法
// 递归实现指数型枚举vector<int> chosen;void calc(int x) { if (x == n + 1) { for (int i = 0; i < chosen.size(); i++) printf("%d ", chosen[i]); puts(""); return; } calc(x + 1); chosen.pu...原创 2020-04-14 14:59:53 · 2883 阅读 · 0 评论 -
算法分析与设计入门级--递推算法(这个要是学不会,就别学算法了)
啥是递推算法?递推法是一种重要的数学方法,在数学的各个领域中都有广泛的运用,也是计算机用于数值计算的一个重要算法。这种算法特点是:一个问题的求解需一系列的计算,在已知条件和所求问题之间总存在着某种相互联系的关系,在计算时,如果可以找到前后过程之间的数量关系(即递推式),那么,从问题出发逐步推到已知条件,此种方法叫逆推。无论顺推还是逆推,其关键是要找到递推式。这种处理问题的方法能使复杂运算化为若干步重复的简单运算,充分发挥出计算机擅长于重复处理的特点。 递推算法的首要问题是得到相邻的数据项间的关系(即递原创 2020-05-12 00:10:41 · 3390 阅读 · 35 评论 -
DFS--POJ 1190 生日蛋糕
Description7月17日是Mr.W的生日,ACM-THU为此要制作一个体积为Nπ的M层生日蛋糕,每层都是一个圆柱体。设从下往上数第i(1 <= i <= M)层蛋糕是半径为Ri, 高度为Hi的圆柱。当i < M时,要求Ri > Ri+1且Hi > Hi+1。由于要在蛋糕上抹奶油,为尽可能节约经费,我们希望蛋糕外表面(最下一层的下底面除外)的面积Q最小。...原创 2020-04-22 11:43:09 · 2729 阅读 · 0 评论 -
贪心--HDU 2021 发工资咯
Description作为杭电的老师,最盼望的日子就是每月的8号了,因为这一天是发工资的日子,养家糊口就靠它了,呵呵,但是对于学校财务处的工作人员来说,这一天则是很忙碌的一天,财务处的小胡老师最近就在考虑一个问题:如果每个老师的工资额都知道,最少需要准备多少张人民币,才能在给每位老师发工资的时候都不用老师找零呢?这里假设老师的工资都是正整数,单位元,人民币一共有100元、50元、10元、5元、2...原创 2020-04-22 11:42:16 · 2806 阅读 · 0 评论 -
Codeforce-CodeCraft-20 (Div. 2)-C. Primitive Primes(本原多项式+数学推导)
It is Professor R’s last class of his teaching career. Every time Professor R taught a class, he gave a special problem for the students to solve. You being his favourite student, put your heart into ...原创 2020-03-05 23:12:02 · 2690 阅读 · 6 评论 -
Codeforce-CodeCraft-20 (Div. 2)-B. String Modification (找规律+模拟)
Vasya has a string s of length n. He decides to make the following modification to the string:Pick an integer k, (1≤k≤n).For i from 1 to n−k+1, reverse the substring s[i:i+k−1] of s. For example, if...原创 2020-03-05 23:10:13 · 2653 阅读 · 0 评论 -
Codeforce-CodeCraft-20 (Div. 2)-A. Grade Allocation
n students are taking an exam. The highest possible score at this exam is m. Let ai be the score of the i-th student. You have access to the school database which stores the results of all students.Y...原创 2020-03-05 23:07:47 · 2673 阅读 · 0 评论 -
Codeforce-Ozon Tech Challenge 2020-C. Kuroni and Impossible Calculation(鸽笼原理)
To become the king of Codeforces, Kuroni has to solve the following problem.He is given n numbers a1,a2,…,an. Help Kuroni to calculate ∏1≤i<j≤n|ai−aj|. As result can be very big, output it modulo ...原创 2020-03-05 22:32:31 · 2694 阅读 · 0 评论 -
Codeforce-Ozon Tech Challenge 2020-A. Kuroni and the Gifts
the i-th necklace has a brightness ai, where all the ai are pairwise distinct (i.e. all ai are different),the i-th bracelet has a brightness bi, where all the bi are pairwise distinct (i.e. all bi ar...原创 2020-03-05 21:09:54 · 2663 阅读 · 0 评论 -
Codeforces Round #509 (Div. 2) A. Heist 贪心
There was an electronic store heist last night.All keyboards which were in the store yesterday were numbered in ascending order from some integer number x. For example, if x=4 and there were 3 keyboa...原创 2020-03-02 17:10:53 · 2670 阅读 · 0 评论 -
CodeForces - 1176A Divide it! (模拟+分类处理)
You are given an integer nn.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times:Replace nn with n2n2 if nn is divisible by 22;Replace nn w...原创 2020-03-02 17:02:46 · 2699 阅读 · 0 评论 -
codeforces 1287A -Angry Students(模拟)
It’s a walking tour day in SIS.Winter, so t groups of students are visiting Torzhok. Streets of Torzhok are so narrow that students have to go in a row one after another.Initially, some students are ...原创 2020-03-02 16:56:09 · 2630 阅读 · 0 评论 -
CF思维联系– Codeforces-989C C. A Mist of Florescence
C. A Mist of Florescencetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output As the boat drifts down the river, a wood full of blossoms shows up on the...原创 2020-02-29 21:06:53 · 2658 阅读 · 0 评论 -
CF思维联系– Codeforces-988C Equal Sums (哈希)
You are given k sequences of integers. The length of the i-th sequence equals to ni.You have to choose exactly two sequences i and j (i≠j) such that you can remove exactly one element in each of the...原创 2020-02-28 23:19:23 · 2671 阅读 · 0 评论 -
CF思维联系–CodeForces -224C - Bracket Sequence
A bracket sequence is a string, containing only characters “(”, “)”, “[” and “]”.A correct bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inser...原创 2020-02-28 00:27:02 · 2640 阅读 · 0 评论 -
CF思维联系–CodeForces - 222 C Reducing Fractions(数学+有技巧的枚举)
To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the frac...原创 2020-02-26 15:15:05 · 2729 阅读 · 0 评论 -
codeforce 1311E. Construct the Binary Tree (构造,就是个模拟)
You are given two integers n and d. You need to construct a rooted binary tree consisting of n vertices with a root at the vertex 1 and the sum of depths of all vertices equals to d.A tree is a conne...原创 2020-02-25 23:02:24 · 2664 阅读 · 0 评论 -
Codeforce 1311A Add Odd or Subtract Even
Add Odd or Subtract Eventime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two positive integers a and b.In one move, you can cha...原创 2020-02-25 01:08:43 · 2633 阅读 · 0 评论 -
Codeforces Round 623(Div. 2,based on VK Cup 2019-2020 - Elimination Round,Engine)D. Recommendations
VK news recommendation system daily selects interesting publications of one of n disjoint categories for each user. Each publication belongs to exactly one category. For each category i batch algorith...原创 2020-02-24 03:16:53 · 2634 阅读 · 3 评论 -
Codeforces Round #623 (Div. 2, based on VK Cup 2019-2020 - Elimination Round, Engine) C. Restoring
C. Restoring Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a sequence b1,b2,…,bn. Find the lexicographically minima...原创 2020-02-24 03:12:28 · 2616 阅读 · 0 评论 -
Codeforces Round #623 (Div. 2, based on VK Cup 2019-2020 - Elimination Round, Engine) B. Homecoming
After a long party Petya decided to return home, but he turned out to be at the opposite end of the town from his home. There are n crossroads in the line in the town, and there is either the bus or t...原创 2020-02-24 03:10:33 · 2643 阅读 · 0 评论 -
Codeforces Round #623 (Div. 2, based on VK Cup 2019-2020 - Elimination Round, Engine) A Dead Pixel
讨论坏点的左右上下的矩形大小。#include <bits/stdc++.h>using namespace std;int main(){ int t; cin >> t; while (t--) { long long a, b, x, y; cin >> a >> b &...原创 2020-02-24 03:07:28 · 2621 阅读 · 0 评论 -
Codeforces Round #622 (Div. 2) 1313 C1
C1. Skyscrapers (easy version)time limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard outputThis is an easier version of the problem. In this version n≤1000...原创 2020-02-23 20:01:27 · 2724 阅读 · 0 评论 -
Codeforces Round #622 (Div. 2) 1313 A
Tired of boring office work, Denis decided to open a fast food restaurant.On the first day he made a portions of dumplings, b portions of cranberry juice and c pancakes with condensed milk.The pecul...原创 2020-02-23 19:57:21 · 2640 阅读 · 0 评论 -
Codeforces Round #622 (Div. 2) 1313 B Different Rules
Nikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be n participants, one of whom is Nikolay. Like any good o...原创 2020-02-23 19:52:40 · 37223 阅读 · 11 评论 -
CF--思维练习--CodeForces - 216C - Hiring Staff (思维+模拟)
A new Berland businessman Vitaly is going to open a household appliances’ store. All he’s got to do now is to hire the staff.The store will work seven days a week, but not around the clock. Every day...原创 2020-02-22 03:46:44 · 2851 阅读 · 0 评论 -
CF--思维练习-- CodeForces - 215C - Crosses(思维题)
There is a board with a grid consisting of n rows and m columns, the rows are numbered from 1 from top to bottom and the columns are numbered from 1 from left to right. In this grid we will denote the...原创 2020-02-22 02:09:16 · 2830 阅读 · 0 评论 -
ACM思维题训练 Section A
题目地址:选题为入门的Codeforce div2/div1的C题和D题。题解:A:CF思维联系–CodeForces -B:CF思维联系–CodeForces -C:CF思维联系–CodeForces -D:CF思维联系–CodeForces -E:CF思维联系–CodeForces - 218C E - Ice Skating (并查集)F:CF–思维练习–CodeForces...原创 2020-02-21 03:18:37 · 3027 阅读 · 0 评论 -
CF--思维练习--CodeForces - 220C Little Elephant and Shifts (STL模拟)
The Little Elephant has two permutations a and b of length n, consisting of numbers from 1 to n, inclusive. Let’s denote the i-th (1 ≤ i ≤ n) element of the permutation a as ai, the j-th (1 ≤ j ≤ n) e...原创 2020-02-21 03:04:09 · 2719 阅读 · 1 评论 -
CF思维联系--CodeForces - 218C E - Ice Skating (并查集)
题目地址:24道CF的DIv2 CD题有兴趣可以做一下。Bajtek is learning to skate on ice. He’s a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding unti...原创 2020-02-21 01:32:30 · 2663 阅读 · 0 评论 -
Codeforces 1291 Round #616 (Div. 2) C. Mind Control(超级详细)
C. Mind ControlYou and your n−1 friends have found an array of integers a1,a2,…,an. You have decided to share it in the following way: All n of you stand in a line in a particular order. Each minute,...原创 2020-02-04 07:13:57 · 2570 阅读 · 0 评论 -
Codeforces 1291 Round #616 (Div. 2) B
B. Array Sharpeningtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou’re given an array a1,…,an of n non-negative integers.Let’s call it sha...原创 2020-02-04 05:50:35 · 2568 阅读 · 0 评论 -
思维+模拟--POJ 1013 Counterfeit Dollar
Sally Jones has a dozen Voyageur silver dollars. However, only eleven of the coins are true silver dollars; one coin is counterfeit even though its color and size make it indistinguishable from the re...原创 2019-12-16 22:48:33 · 2574 阅读 · 0 评论 -
Codeforce 1255 Round #601 (Div. 2)D. Feeding Chicken (模拟)
Long is a huge fan of CFC (Codeforces Fried Chicken). But the price of CFC is increasing, so he decides to breed the chicken on his own farm.His farm is presented by a rectangle grid withrrrows an...原创 2019-11-20 22:04:06 · 2578 阅读 · 0 评论 -
Codeforce 1255 Round #601 (Div. 2) C. League of Leesins (大模拟)
Bob is an avid fan of the video game "League of Leesins", and today he celebrates as the League of Leesins World Championship comes to an end!The tournament consisted ofnn(n≥5n≥5) teams around the...原创 2019-11-20 21:41:15 · 2617 阅读 · 0 评论 -
Codeforce 1255 Round #601 (Div. 2)B. Fridge Lockers(思维)
Hanh lives in a shared apartment. There arennpeople (including Hanh) living there, each has a private fridge.nnfridges are secured by several steel chains. Each steel chain connects twodifferent...原创 2019-11-20 21:36:33 · 2580 阅读 · 0 评论 -
A Tile Painting(循环节)
Ujan has been lazy lately, but now has decided to bring his yard to good shape. First, he decided to paint the path from his house to the gate.The path consists ofnnconsecutive tiles, numbered fro...原创 2019-11-19 20:28:03 · 2656 阅读 · 0 评论 -
String(字符串) 比较大小 如果有A+B>B+A 则A>B
题目引入:给定N个整数,那任意顺序排列连成一个数,得到的最大的数是多少?分析:贪心,字典序排序,都不对大小比较也不对,今天我跟别人想了很久绞尽脑汁,各种模拟都失败了。最后才发现对于俩个数a=313,b=3133。若a排在b前则构造的数字为3133133,另一种是3133313明显第二种较大,那么b是排在a前面的。那么也就是说当有N个数的时候,基于这个排序准则排序即可。那么就会得到最...原创 2019-11-19 15:29:00 · 3319 阅读 · 1 评论 -
CodeForces - 1245 C - Constanze's Machine
Codeforces Round #597 (Div. 2) Constanze is the smartest girl in her village but she has bad eyesight.One day, she was able to invent an incredible machine! When you pronounce letters, the mach...原创 2019-11-06 23:30:29 · 2546 阅读 · 1 评论 -
CodeForces - 1245A Good ol' Numbers Coloring (思维)
Codeforces Round #597 (Div. 2 Consider the set of all nonnegative integers:0,1,2,…. Given two integersaandb(1≤a,b≤104). We paint all the numbers in increasing number first we paint0, then we p...原创 2019-11-06 23:20:36 · 2631 阅读 · 0 评论