VJ
文章平均质量分 63
MarigoldLi
这个作者很懒,什么都没留下…
展开
-
HRBU_20211119训练
HRBU_20211119训练E - Justifying the Conjecture题意判断一个数是否有一个素数和一个合数组成思路当n<=5时,不符合要求,当n>5时,当n是奇数时,是3和n-3,当n是偶数时,是 n-2.代码#include<stdio.h>#include<iostream>using namespace std;int main(){ int t; cin>>t; while(t--)原创 2021-11-21 19:43:56 · 301 阅读 · 0 评论 -
HRBU_20211117训练(2020CCPC网络赛)
HRBU_20211117训练F - Reports题意判断一系列的数,是否有两个连续相同的数字,是输出NO,否则输出YES思路每个遍历是否相同输出即可代码#include<stdio.h>#include<iostream>using namespace std;int a[55];int main(){ int t; cin>>t; while(t--) { int n; cin&原创 2021-11-18 20:25:05 · 456 阅读 · 0 评论 -
HRBU_20211110训练(2019CCPC秦皇岛)
HRBU_20211110训练(2019CCPC秦皇岛)B - Decimal题意给一个整数n,判断1/n是否无穷小数,如果是,输出yes;如果不是,输出no.思路判断是否含有质因子2 和5,如果有则是可以整除,否则不能。代码#include<stdio.h>#include<iostream>using namespace std;int main(){ int t; cin>>t; while(t--) {原创 2021-11-11 22:39:49 · 148 阅读 · 0 评论 -
HRBU_20211108训练(2019CCPC江西省省赛)
HRBU_20211108训练B - Wave题意一个序列称为“波”,至少有两个元素,在奇数位数字应该相同,偶数位的数字相同,求这样的子序列至少多长?例如1212,是符合题意的要求,而它的长度为4,这样的一直重复下去的就是正确的,算出长度即可。思路这是一道DP题,首先先明确一点的是如果没有符合的子序列那么最短的长度为2,其次我觉得最重要的一点是找出状态转换方程dp[j][num] = dp [num][j] + 1 .代码#include<stdio.h>#include<原创 2021-11-09 16:33:30 · 106 阅读 · 0 评论 -
HRBU_20211103训练
HRBU_20211103训练A - Linear Keyboard题意这题是输入两个字符串,求出第二个字符串在第一个字符串的位置每个位置的差值之和。思路利用c++的find函数,我感觉这题是为find()量身定做的一个题。代码#include<stdio.h>#include<iostream>using namespace std;int main(){ int t; cin>>t; while(t--) {原创 2021-11-06 15:58:55 · 547 阅读 · 0 评论 -
HRBU_20211105训练
HRBU_20211105训练A - Three Piles of Candies题意有三个数量不相等的糖果的盒子,Alice和Bob都想要得到尽可能多的糖果,条件是两个人的糖果数量都必须相等,例如有糖果 1 3 4,一个人拿第三个盒子的糖果,另一个人拿第一和第二个盒子,这样他们俩得到的糖果数量都相等,当是一个人的数量比另一个人数量多一时,数量多的人丢弃一个糖果,这样糖果数量时相等的,问两个人最多可以得到多少糖果。思路把所有糖果的数量相加除以2,即可得到最多可以得到的糖果。代码#include原创 2021-11-06 14:32:34 · 131 阅读 · 0 评论 -
HRBU_20211029训练(codeforces round #751(div2))
HRBU_20211029训练A - Two Subsequences题意给出一组序列,要求分成两组序列,第一组是字符串中最小的字母,而剩余的字母是第二个序列思路遍历所有的字母求出最小的字母,其他的字符输出在另一个子序列中。代码#include<stdio.h>#include<iostream>using namespace std;int main(){ int t; cin>>t; while(t--) {原创 2021-11-02 19:09:21 · 141 阅读 · 1 评论 -
HRBU_20211101训练(codeforces round #752(div2))
HRBU_20211101训练A - Era题意在一组数中任意插入几个数,是这组数满足a i<= i;并且下标是从1开始的,问需要插入几个数,才能满足于上述条件。思路求出a[i]-i的最大值,就是为了比较该数与数的下标相差多少,如果相等的话,说明该数就是数的下标的值,只需要比较出最大值即可,举例说明一下:1 2 3 4 5;每个数的下标与数的差值均为零,可以看出a[i]==i;1 2 3 4 6;可以看出只有数字6与数字下标5相差1,而在这里只需要补充一个5即可,即只需要补充一个数字即可原创 2021-11-01 20:27:26 · 122 阅读 · 0 评论 -
HRBU_20211027训练
HRBU_20211027训练A - Luntik and Concerts题意一共有三种时间的歌曲,a个一分钟,b个两分钟,c个三分钟,把这些歌曲分为两组,要求两组的时间相差最短。思路把所有的时间相加求和,判断是奇数还是偶数,若是奇数相差1,若为偶数,则相差0.代码#include<stdio.h>#define ll long long#include<iostream>using namespace std;int main(){ int t;原创 2021-10-27 22:46:02 · 223 阅读 · 0 评论 -
HRBU_20211025训练
HRBU_20211025训练题意三个人投票,问三个候选人至少有多少票才能胜利,例如A,B,C分别获得1,2,3票,那么c赢了,他离胜利只差0票,B差2票,A差3票,较小的只需要用最大值减去该值+1即可。思路分别比较求出最大值,用最大值减去该值+1代码#include<cstdio>#include<iostream>#define ll long longusing namespace std;int main(){ int t; cin>原创 2021-10-26 08:25:40 · 126 阅读 · 0 评论 -
HRBU10 04训练
A - Gamer Hemose题意给定长度为n的数组为你的攻击伤害值,h为敌人的健康值,你可以选择敌人的健康值,你可以选择不同的攻击扣掉敌人的相应健康值,相同的攻击不可以连续使用,问你最少需要多少次将敌人的健康值扣为零,或者是负数思路选择最高伤害值交替使用。代码#include<stdio.h>#include<iostream>#include<algorithm>using namespace std;int main(){ int原创 2021-10-24 20:03:20 · 101 阅读 · 0 评论 -
HRBU--10.1训练
A - CQXYM Count Permutations题意1~2n的数字序列的排列组合一共有(2n)!种不同的结果。请问,在这些结果种,正序下标的数量不少于n的有多少个呢?结果队10^9+7进行取模。在这里解释一下正序下标的意思是如果a[i]<a[i+1],则称为i为正序下标。思路这其实会有一般的结果满足条件即1/2(2n)!满足代码#include<stdio.h>#include<iostream>#define ll long long#define原创 2021-10-24 19:42:47 · 136 阅读 · 0 评论 -
HRBU_20210929训练
HRBU_20210929训练 codeforces1579A - Casimir's String Solitaire题意解法代码B-Shifting sort题意分析代码E-Permutation Minimization by Deque题意思路代码总结A - Casimir’s String Solitaire题意给定一个字符串,要求把这个字符串消除万,消除规则:1.你可以消除任意两个A和C2.你也可以消除任意两个B和C问:你可以把字符串消除完吗?解法判断B是否等于A和C之和代码原创 2021-10-24 19:04:46 · 119 阅读 · 0 评论 -
HRBU_20211013训练 (codeforces Round #574(div2))
codeforces Round #574(div2)A - Drinks Choosing题意有n个同学需要饮料,饮料店有K种饮料,第i个同学想要喝第ai(1<=ai<=k)种饮料,如果n为奇数,你可以把一瓶给老师喝,如果n为偶数,你就只有n瓶,问有多少同学喜欢喝自己喜欢的饮料。思路把相同饮料的个数相加,遍历所有的k,算出每种饮料的一半加上(n+1)/2,最后输出结果。代码#include<stdio.h>#include<iostream>using原创 2021-10-14 23:04:02 · 128 阅读 · 1 评论 -
HRBU_20211006训练
HRBU_20211006训练A - Nearest Interesting NumberB - Equalize PricesC - Computer GameD - Candy Box (easy version)HRBU_20211006训练HRBU_20211006训练A - Nearest Interesting Number题意代码B - Equalize Prices题意代码C - Computer Game题意代码D - Candy Box (easy version)题意代码总结原创 2021-10-11 21:53:31 · 547 阅读 · 0 评论 -
HRBU_20211011训练
HRBU_20211011训练A - Consecutive Sum Riddle题意B - Special Numbers题意代码C - Make Them Equal题意总结A - Consecutive Sum Riddle题意从l到r求和为n,已知n,求l,r;因为-(n-1)+(n-1)=0+n=n;所以输出(-n+1)和n即可#include<stdio.h>#include<iostream>using namespace std;int main()原创 2021-10-11 21:13:36 · 182 阅读 · 0 评论 -
HRBU_20211008训练
系列文章目录提示:这里可以添加系列文章的所有文章的目录,目录需要自己手动添加例如:第一章 Python 机器学习入门之pandas的使用提示:写完文章后,目录可以自动生成,如何生成可参考右边的帮助文档HRBU_20211008训练系列文章目录题意题意代码题意代码总结题目来源A - Keanu Reeves题意输入一个长度为n的二进制字符,把它分为尽可能少的子串,且子串要求为1和0的个数不一样,先判断子串的1和0的个数是否相等,如果相等,直接输出该子串,如果不相等,把第一个字符输出,其余字符原创 2021-10-09 17:00:24 · 115 阅读 · 0 评论 -
二Day 2 B - Depth First Search
二Day 2 B - Depth First Search题目正文题意代码总结题目正文Depth-first search (DFS) follows the strategy to search ”deeper” in the graph whenever possible. In DFS, edges are recursively explored out of the most recently discovered vertex v that still has unexplored edg原创 2021-08-06 15:02:04 · 144 阅读 · 0 评论 -
二Day1 F - Oil Deposits
F - Oil Deposits题目正文题意代码总结题目正文The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a grid that divides the land into numerous sq原创 2021-08-06 14:31:43 · 94 阅读 · 0 评论 -
二Day1A - Breadth First Search
二Day1A - Breadth First Search题目正文代码总结题目正文Write a program which reads an directed graph G=(V,E), and finds the shortest distance from vertex 1 to each vertex (the number of edges in the shortest path). Vertices are identified by IDs 1,2,…n.InputIn the f原创 2021-08-06 14:27:31 · 119 阅读 · 0 评论 -
Day4 D - Let the Balloon Rise
Day4 D - Let the Balloon Rise题目正文题意代码总结题目正文Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges’ favorite time is guessing the most popular problem. When the contest is over, they will count the bal原创 2021-08-05 11:57:17 · 83 阅读 · 0 评论 -
Day2 C - Running Median
Day2 C - Running Median题目正文翻译代码总结题目正文For this problem, you will write a program that reads in a sequence of 32-bit signed integers. After each odd-indexed value is read, output the median (middle value) of the elements received so far.InputThe first l原创 2021-08-05 11:43:09 · 149 阅读 · 0 评论 -
Day2 B - Stones
Day2 B - Stones题目正文翻译题意代码总结题目正文Because of the wrong status of the bicycle, Sempr begin to walk east to west every morning and walk back every evening. Walking may cause a little tired, so Sempr always play some games this time.There are many stones on原创 2021-08-05 11:34:00 · 170 阅读 · 0 评论 -
Day 2 A - The Balance of the World
Day 2 A - The Balance of the World题目正文翻译题意代码总结题目正文The world should be finely balanced. Positive vs. negative, light vs. shadow, and left vs. right brackets. Your mission is to write a program that judges whether a string is balanced with respect to brack原创 2021-08-05 11:15:07 · 91 阅读 · 0 评论 -
Day3 D - Anagram
Day3 D - Anagram题目正文翻译样例代码总结题目正文You are to write a program that has to generate all possible words from a given set of letters.Example: Given the word “abc”, your program should - by exploring all different combination of the three letters - output the原创 2021-08-03 10:08:20 · 254 阅读 · 0 评论 -
Day3 C - 士兵队列训练问题
Day3 C - 士兵队列训练问题题目正文输入输出样例代码总结题目正文某部队进行新兵队列训练,将新兵从一开始按顺序依次编号,并排成一行横队,训练的规则如下:从头开始一至二报数,凡报到二的出列,剩下的向小序号方向靠拢,再从头开始进行一至三报数,凡报到三的出列,剩下的向小序号方向靠拢,继续从头开始进行一至二报数。。。,以后从头开始轮流进行一至二报数、一至三报数直到剩下的人数不超过三人为止。输入本题有多个测试数据组,第一行为组数N,接着为N行新兵人数,新兵人数不超过5000。输出共有N行,分别对应输入原创 2021-08-03 09:35:12 · 1195 阅读 · 0 评论