自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(68)
  • 收藏
  • 关注

原创 C语言学生信息管理系统(接C语言,c++,各种管理系统定制)

接C语言,c++,各种管理系统定制,价格优惠,代码质量高,包售后,包答疑,服务态度好,代码质量高,绝对让你满意。可加微信咨询:dtfdf333。-------学生信息管理系统--------------学生信息管理系统-------6.按成绩对学生信息进行排序。7.按学号对学生信息进行排序。9.输出所有学生信息。

2023-08-28 21:36:09 63

原创 HDU - 5616Jam‘s balance【二进制枚举详细讲解】

传送门题意,t组样例,每个样例先给你一个n,下面是n个数分别表示第几个秤砣的重量,再给你一个数m,下面是m个数,表示你要判断是否能称出的物品重量,秤砣可以放两边,如果可以称出来输出YES,否则输出NO我首先简单说一下二进制枚举,对于 4 7 12 18 四个重量,我们可以用四位数字表示例如0100,0101,如果第i位数字是1表示用第i个秤砣(从右往左看),为零则不用。那么0100表示只用第3个秤砣,0101表示用第1,3个秤砣.我们要枚举每种状态,那么我们怎么枚举呢?我们以上面的例子为例,n为4,

2020-10-30 20:22:52 286

原创 LightOJ - 1074Extended Traffic【spfa判断负环】

#include<iostream>#include<algorithm>#include<cstring>#include<cmath>#include<queue>#include<stack>#include<map>using namespace std;#define ll long longint dss[210],dis[210],head[210],vis[210],sum[210],cyc

2020-10-24 11:41:33 97

原创 HDU - 4725The Shortest Path in Nya Graph【巧妙构图】

题意t组样例,首先输入n,m,d,表示n个点,m个边,每相邻两层的权值d,下面是n个数,表示第i个点在第a[i]层,下面是m条边,每条边包含三个数u,v,w,表示双向联通点,u,v,之间的权值w,每相邻两层的任意点距离都是d问:点1到点n是否连通,连通的话输出最短距离,否则输出-1.思路:我们当然可以想到dijkstra(),直接连通相邻层数的所有点,权值为d,但点的个数1e5,开不了那么大的数组,我们可以构建虚拟节点,使每层的虚拟节点与每层的点的权值为零,和相邻层的虚拟节点的权值为d,建图然后模.

2020-10-24 06:23:50 89

原创 Codeforces Round #663 (Div. 2)C. Cyclic Permutations【找规律】

参考大佬的博客写的很好https://blog.csdn.net/qq_43627087/article/details/107927412?biz_id=102&utm_term=Codeforces%20Round%20#663%20Div.%202&utm_medium=distribute.pc_search_result.none-task-blog-2allsobaiduweb~default-1-107927412&spm=1018.2118.3001.4187题.

2020-10-21 20:15:04 92

原创 Codeforces Round #656 (Div. 3)D. a-Good String【搜索】

题目传送门You are given a string s[1…n] consisting of lowercase Latin letters. It is guaranteed that n=2k for some integer k≥0.The string s[1…n] is called c-good if at least one of the following three conditions is satisfied:The length of s is 1, and it con

2020-10-20 21:21:08 208

原创 Codeforces Round #656 (Div. 3)C. Make It Good【找规律】

题目传送门You are given an array a consisting of n integers. You have to find the length of the smallest (shortest) prefix of elements you need to erase from a to make it a good array. Recall that the prefix of the array a=[a1,a2,…,an] is a subarray consistin

2020-10-20 19:27:09 92

原创 Codeforces Round #658 (Div. 1)A1. Prefix Flip (Easy Version)【思维】

题目传送门This is the easy version of the problem. The difference between the versions is the constraint on n and the required number of operations. You can make hacks only if all versions of the problem are solved.There are two binary strings a and b of len

2020-10-19 21:16:16 119

原创 Educational Codeforces Round 91 (Rated for Div. 2)C. Create The Teams【贪心】

题目传送门There are n programmers that you want to split into several non-empty teams. The skill of the i-th programmer is ai. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the t

2020-10-19 14:22:40 135

原创 Codeforces Round #666 (Div. 2)B. Power Sequence【暴力】

题目传送门Let’s call a list of positive integers a0,a1,…,an−1 a power sequence if there is a positive integer c, so that for every 0≤i≤n−1 then ai=ci.Given a list of n positive integers a0,a1,…,an−1, you are allowed to:Reorder the list (i.e. pick a permutat

2020-10-19 13:47:13 114

原创 Bubble Cup 13 - Finals [Online Mirror, unrated, Div. 1]K. Lonely Numbers【打表+线性筛模板+前缀和】

题目传送门In number world, two different numbers are friends if they have a lot in common, but also each one has unique perks.More precisely, two different numbers a and b are friends if gcd(a,b), agcd(a,b), bgcd(a,b) can form sides of a triangle.Three numb

2020-10-17 20:01:05 223

原创 Codeforces Round #661 (Div. 3)D. Binary String To Subsequences【vector】

参考大佬的博客,写的很好https://blog.csdn.net/qq_43765333/article/details/107861858?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522160292028519724848333971%2522%252C%2522scm%2522%253A%252220140713.130102334…%2522%257D&request_id=160292028519724848333971&.

2020-10-17 16:27:28 82

原创 Educational Codeforces Round 94 (Rated for Div. 2)C. Binary String Reconstruction【思维】

题目传送门Consider the following process. You have a binary string (a string where each character is either 0 or 1) w of length n and an integer x. You build a new binary string s consisting of n characters. The i-th character of s is chosen as follows:if th

2020-10-17 14:50:35 65

原创 Codeforces Round #674 (Div. 3)D. Non-zero Segments【前缀和+思维】

题目传送门Kolya got an integer array a1,a2,…,an. The array can contain both positive and negative integers, but Kolya doesn’t like 0, so the array doesn’t contain any zeros.Kolya doesn’t like that the sum of some subsegments of his array can be 0. The subseg

2020-10-16 20:40:43 131

原创 Codeforces Round #668 (Div. 1)A. Balanced Bitstring

题目传送门A bitstring is a string consisting only of the characters 0 and 1. A bitstring is called k-balanced if every substring of size k of this bitstring has an equal amount of 0 and 1 characters (k2 of each).You are given an integer k and a string s whic

2020-10-15 15:53:29 122

原创 Codeforces Round #673 (Div. 1)A. k-Amazing Numbers

参考大佬的博客https://blog.csdn.net/weixin_44582673/article/details/108964461?biz_id=102&utm_term=Codeforces%20Round%20#673%20Div.%201A&utm_medium=distribute.pc_search_result.none-task-blog-2allsobaiduweb~default-1-108964461&spm=1018.2118.3001.4187.

2020-10-13 19:10:17 143

原创 Bubble Cup 13 - Finals [Online Mirror, unrated, Div. 2]G. Years【差分+优先队列】

题目传送门G. Yearstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputDuring one of the space missions, humans have found an evidence of previous life at one of the planets. They were lucky enough to find

2020-10-12 20:20:06 503

原创 POJ - 1511Invitation Cards【正反向+dijkstra+链式前向星】

题目传送门In the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this fact. They want to propagate theater and, most of all, Antique Comedies. They have printed invitation cards with all the necess

2020-10-09 11:05:15 123

原创 HDU - 6266 Hakase and Nano【思维】

题目Problem C. Hakase and NanoHakase and Nano are playing an ancient pebble game (pebble is a kind of rock). There are n packsof pebbles, and the i-th pack contains ai pebbles. They take turns to pick up pebbles. In each turn,they can choose a pack arbit

2020-10-09 09:48:54 123

原创 HDU - 6273Master of GCD【一维差分】

题目Problem J. Master of GCDHakase has n numbers in a line. At first, they are all equal to 1. Besides, Hakase is interested inprimes. She will choose a continuous subsequence [l, r] and a prime parameter x each time and forevery l ≤ i ≤ r, she will chan

2020-10-08 21:20:42 104

原创 HDU - 6264 Super-palindrome 【思维】

题目You are given a string that is consisted of lowercase English alphabet. You are supposed to change itinto a super-palindrome string in minimum steps. You can change one character in string to anotherletter per step.A string is called a super-palindro

2020-10-08 21:04:26 59

原创 ZOJ - 3944 People Counting【暴力模拟】

题目传送门Sample Input23 3.O./|(.)3 4OOO(/|\()))Sample Output14题意:给你一个n*m的图,问图中有几个人,图中的某一部分也可以代表一个人思路:暴力,找到的每一部分都消去和他是同一个人的那部分AC code#include<iostream>#include<algorithm>#include<cstring>#include<cmath>#inclu

2020-10-06 21:29:34 97

原创 ZOJ - 3938 Defuse the Bomb【模拟】

题目传送门题意:总共有5步,每步屏幕显示的1,2,3,4都有不同的操作,问:你每次按得位置和按钮上的数字分别为多少.思路:没什么好办法,一步一步模拟…AC code#include<bits/stdc++.h>using namespace std;int a[7][7],b[5][2];int main(){ ios::sync_with_stdio(0); int t; cin>>t; while(t--) {

2020-10-06 21:23:16 101

原创 ZOJ - 3939 The Lucky Week【简单方法】

题目传送门Sample Input22016 4 11 22016 1 11 10Sample Output2016 7 112017 9 11题意:t组数据,给出四个数,x,y,z,m,其中 x,y,z,分别是第一个幸运日的年月日,幸运日的定义为每月的1,11,或21,号且星期一,问第m个幸运日的年月日注意第一个幸运日的范围为(1753 1.1~9999 12 .31)并不是要求的所有幸运日都在这个范围内思路:暴力的话,1e9肯定超时,我们可以找下规律,我们发现从第一个幸

2020-10-06 21:10:06 93

原创 Codeforces Round #672 (Div. 2)B. Rock and Lever【找规律】

题目传送门input551 4 3 7 1031 1 146 2 5 322 411output13200题意:T组输入,每次先输入一个n,下面是n个数,问:有几对数字满足 ai & aj≥ai⊕aj,打表之后我们可以发现如果ai的二进制长度等于aj就能满足AC code#include<iostream>#include<algorithm>#include<cstring>#include&lt

2020-10-05 21:46:24 97

原创 Codeforces Round #672 (Div. 2)C1. Pokémon Army (easy version)【dp】

题目输入33 01 3 22 01 27 01 2 5 4 3 6 7输出329题意:t组测试样例,下面两个数n,m;在下面是n个数,从中按顺序选不超过n个数满足这几个数的先加后减运算值最大.思路:dp[i][0]表示这一个数应该进行的是减法,当然也可以对这个数不操作dp[i][1]表示这一个数应该进行的是加法AC code#include<iostream>#include<algorithm>#include<cstrin

2020-10-05 21:39:25 78

原创 Codeforces Round #672 (Div. 2)C1. Pokémon Army (easy version)【思维+贪心】

题目传送门输入33 01 3 22 01 27 01 2 5 4 3 6 7输出329题意:t组测试样例,下面两个数n,m;在下面是n个数,从中按顺序选不超过n个数满足这几个数的先加后减运算值最大.思路:我们肯定要加上最大的减去最小的,即为加上一段上升序列中最大值,下降序列中最小值,最后一步操作一定应该为加法,这样保证.值最大AC code#include<iostream>#include<algorithm>#include&l

2020-10-05 21:32:43 125

原创 Gym - 102220BBalanced Diet【vector】

参考大佬的博客写的很好https://blog.csdn.net/qq_43750980/article/details/103130387?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522160189465619724839206957%2522%252C%2522scm%2522%253A%252220140713.130102334…%2522%257D&request_id=160189465619724839206957&a.

2020-10-05 21:13:31 155

原创 A. Arena of Greed【贪心+特判】

题目传送门inputCopy256outputCopy24题意:T组测试样例,每组一个数n,有n个物品,两个人轮流拿操作,有以下两种操作1:拿一个物品2:当n为偶数时拿一半物品.问:第一个人先手,最多可以得到多少物品思路:第一种操作不会有什么问题,对于第二种操作我们有两种选择,1拿一个,2拿一半,,他们应该尽可能保证在另一个人拿一个的情况下自己拿一半,例如12,如果我们不判断上面的条件直接拿一半的话,第一个人:6 1 1,第二个人:3 1;但是我们用上面的条件判断后第一

2020-10-05 16:44:28 356

原创 F. Flamingoes of Mystery【人生第一道交互题】

题目传送门input651510output? 1 2? 5 6? 3 4! 1 4 4 6 7 8题意:第一道交互题,首先给你一个数n说明有n个笼子,你最多能问n次,对于你的询问,机器会给出答案,问:每个笼子里各有几只火烈鸟思路:每次询问我们至少得出一个笼子中有几只,例如我们先问1-2,1~3,这样我们就会知道第三个笼子有几只,这样问到1-n,问了n-1次,我们最后问一次2-3就可以得到第二个笼子有几只,我们有1-2,进而得出第一个笼子中的数量,这样就可以了,注意:每

2020-10-05 16:26:52 149

原创 Gym - 101673HSheba‘s Amoebas【dfs】

题目传送门输入:12 12.##########.#..........##..#...##..##.##..#..#.##......#.#.##....#..#..##...#.#....##..#...#...#.#..#.#....##....#.....##.........#..#########..输出4输入12 10.#####....#.....#...#..#..#...#.#.#.#...#..#..#....#...#......#

2020-10-04 21:36:23 100

原创 Gym - 101673D Game of Throwns【模拟】

题目传送门输入:5 48 -2 3 undo 2输出3输入5 107 -3 undo 1 4 3 -9 5 undo 2 undo 1 6输出2题意:给出两个数n,m,n个孩子从1~n-1,m个操作,第一种操作输入一个x就是从当前孩子传给距离它x个单位的孩子(默认从第零个孩子开始传,孩子成环)第二种操作undo x,表示返回前几个的状态,例如球从1-3-4-6,此时undo2,就是把球从6孩子给3孩子思路:模拟,具体看代码#include<iostream&

2020-10-04 21:29:07 126

原创 Gym - 101673C DRM Messages

题目传送门Sample Input 1EWPGAJRBSample Output 1ABCDSample Input 2UEQBJPJCBUDGBNKCAHXCVERXUCVKSample Output 2ACMECNACONTEST题意:给出一个字符串执行以下三步操作1:把字符串分为前后相等的两部分2:把前一半的价值相加,每一个字符都加上这个价值得到另一个字符.后一半进行同样操作3 把前一半的每个字符分别加上后一半的对应字符的价值得到新的串AC code#inclu

2020-10-04 21:18:01 3211

原创 Gym - 101875II Will Go【模板dfs序】

推荐一波大佬讲解dfs序和欧拉序非常详细https://www.cnblogs.com/stxy-ferryman/p/7741970.html题目传送门Input3 21 2 -10 22 0OutputYesNo题意:给出两个数n,m,下面是n个人的好朋友,如果为-1的话表示他没有好朋友,他的好朋友去了他一定去,这个人去了的话他的好朋友不一定去.下面是m个询问,问x去了y会去吗?思路:我们只要判断y是否为x的祖先即可,在dfs序中我们以没有好朋友的人分别为根建树然.

2020-10-04 10:11:33 311

原创 Gym - 102394K Keeping Rabbits【简单题】

题目传送门Input31 122 21 33 21 1 1Output3.000000001.50000000 4.500000001.66666667 1.66666667 1.66666667题意:多组输入,首先一个t,t个样例,后面两个数n,m,n只兔子,求m天后兔子的期望重量,每天给一磅胡萝卜,兔子增重的概率由其体重在所有兔子体重占的比例决定思路:兔子每天增重的期望就是体重占比一直不变,我们直接求m天就可以了AC code#include<ios

2020-10-03 23:26:39 238

原创 Gym - 102394Justifying the Conjecture【找规律】

题目传送门Input3467Output-12 43 4题意:给出一个数判断是否能拆成一个素数和合数,可以的话输出素数和合数,否则输出-1思路:模拟之后发现这个数减去2或3后剩下的数如果能整除2那么这个数就是符合条件的,否则输出-1,具体上代码AC code#include<iostream>#include<algorithm>#include<cstring>#include<cmath>#include&

2020-10-03 23:15:22 88

原创 Gym - 102394FFixing Banners【全排列函数】

题目传送门Input2welcometoparticipateintheccpccontestinharbininoctoberharvestbelongninjaresetamazingintriguingOutputNoYes题意:t组样例,每组六个字符串,问是否能分别从六个字符串中各挑出一个字母组成单词“harbin”思路:我们可以先标记一下每个字符串中出现过哪个字符,然后直接用全排列函数判断串中是否含有该有的字符即可AC code#inclu

2020-10-03 19:37:41 133

原创 Gym - 102394IInteresting Permutation【特判+思维】

题目传送门Input330 2 230 1 230 2 3Output240题意:t组测试样例,开头一个n,下面是n个数,分别为前i个数的最大值和最小值之差,问:1~n有几种排列方法满足条件思路:首先特别判定一下a[0]应该等于零,a[i]>=a[i-1],a[i]<n;满足这三个前提条件后有两种情况:1:a[i]>a[i-1]此时前i个数的最大值或最小值更新,总数乘以2,最大值更新他们中间数(最大值和最小值中间还未用到的数)的总数增加,计算他们

2020-10-03 19:29:27 228

原创 Gym - 101875L PC is for kicking【bfs】

参考大佬的博客写的很好https://blog.csdn.net/gtgym321/article/details/90145411题目传送门Input5 21 21 32 53 4Output4题意:给出两个数n,m,下面是n-1行,每行有两个数表示连通,从m点开始走最多能走过几个点(不能重复)思路bfs遍历AC code#include<iostream>#include<algorithm>#include<cstring.

2020-10-02 21:49:31 864

原创 Gym - 101875FNumber Preference【思维】

题目传送门Input31 3 1 2 32 1 11 3 1 2 4Output1Input51 3 1 2 31 3 1 2 41 3 1 2 51 3 1 2 72 1 8Output2Input21 2 10 112 2 10 11Output0题意:给出一个数n,下面是n个人,每个人的开头有一个数1或2后面跟着一个数m,如果是一的话表示后面是这个人喜欢的m个数,否则为厌恶的m个数.问:有多少的个数是所有人都喜欢的,输出这个数.思路:我们可

2020-10-02 21:36:42 129

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除