codeforces
Celavia_yu
这个作者很懒,什么都没留下…
展开
-
Codeforces Global Round 10——A.B!.C
Codeforces Global Round 10A. Omkar and Password题意:t组输入,每组n个数,数组a,可进行操作:相邻的两个值不同,则可以相加并替换掉这相邻的两个值,问最后数组剩余的长度最小值。思路:只要数组里有超过两个不相同的数,就是可以相加得到最后只剩一个数。否则就是全部都相同的值,直接输出n。代码#include<bits/stdc++.h>using namespace std;int T,n;int a[200005];map<int原创 2020-08-17 09:16:52 · 185 阅读 · 0 评论 -
Codeforces Round #664 (Div. 2)——A. Boboniu Likes to Color Balls,B. Boboniu Plays Chess
Codeforces Round #664 (Div. 2)A. Boboniu Likes to Color Balls题意:总共四个颜色,可以进行的操作是,前三个一人拿一个放到第四个,就相当于前三个原创 2020-08-13 09:13:17 · 204 阅读 · 0 评论 -
Codeforces Round #661 (Div. 3)——A.B.C.D.
Codeforces Round #661 (Div. 3)A. Remove Smallest原创 2020-08-06 13:12:19 · 227 阅读 · 0 评论 -
Codeforces Round #660 (Div. 2)——A.B.
A. Captain Flint and Crew Recruitment题意:就是定义由两个质数相乘得到的数称为近似指数。给定一个n,问是否有可能由4个正整数,其中三个是近似指数,另一个没做要求。思路:一开始呢,我是原创 2020-07-31 10:26:53 · 191 阅读 · 0 评论 -
Educational Codeforces Round 92 (Rated for Div. 2)——A.B.C.D.
A. LCM Problem题意:t组输入,左右区间,区间内存在两个数的LCD(最小公倍数)的值在左右区间内 打印俩个数,否则-1 -1。思路:两个数最小公倍数就是两倍关系,判断区间左端点的两倍是否在有区间以内,在就是l 2*l,不在就是 -1 -1。代码#include<stdio.h>#include<bits/stdc++.h>using namespace std;int main(){ int t; scanf("%d",&t);原创 2020-07-30 15:51:05 · 217 阅读 · 1 评论 -
Codeforces Round #658 (Div. 2)——D. Unmerge
D. Unmerge题目描述Exampleinput622 3 1 423 1 2 443 2 6 1 5 7 8 431 2 3 4 5 646 1 3 7 4 5 8 264 3 2 5 1 11 9 12 8 6 10 7outputYESNOYESYESNONO**题意思路:**给一个长度为2×n长的数组,问是否可有两个长度为n的数组合并而成,合并规则如下:a数组的数组头小于b的数组头就放入合成字符串中,删去这个被拿走的,补位,继续比较,知道全部原创 2020-07-26 23:26:43 · 112 阅读 · 0 评论 -
Codeforces Round #254 (Div. 2)——B(并查集).
B. DZY Loves Chemistry题目描述Exampleinput1 0output1input2 11 2output2input3 21 22 3output4题意思路:n,m,n瓶化学药水,m种反应,如若这个化学药品加入大烧杯中,与已在大烧杯中的化学药水产生了化学反应,则危险值×2,否则危险值不变,空烧杯危险值为1。求最后全部药水加入后的危险值的最大值。利用并查集找到每个药水是否存在与之反应的(多个与之反应的也是×2),有的话就×2,不存在则原创 2020-07-22 23:37:57 · 114 阅读 · 0 评论 -
Codeforces Round #658 (Div. 2)——A.B.C1.C2(字符串).(补题)
Codeforces Round #658 (Div. 2)题目描述Exampleinput54 510 8 6 41 2 3 4 51 1331 1325 31000 2 2 2 33 1 55 51 2 3 4 51 2 3 4 5outputYES1 4YES1 3NOYES1 3YES1 2题意思路:两个数组,分别为n个 ,m个。找一个子字符串同时属于a,b字符串。子字符串不限长度及其他条件,那只需要找到是否一个数值是两组都有的即可。原创 2020-07-22 11:21:54 · 164 阅读 · 0 评论 -
Codeforces Round #254 (Div. 2)——A. DZY Loves Chessboard(dfs)
Codeforces Round #254 (Div. 2)题目描述Exampleinput1 1.outputBinput2 2....outputBWWBinput3 3.-.-----.outputB-B-----B题意思路:黑白棋放入存在坏掉的(-)的棋盘中,黑白棋不相邻的摆放方式输出。想到了dfs,但是没写对。主要就是每一片(连在一个的“.”们)可以放棋的地方(.)是一起dfs到底,一片一片来的,而我想的是从左上角到右下角没有想到中间处理过原创 2020-07-21 18:38:51 · 130 阅读 · 0 评论 -
Codeforces Round #627 (Div. 3)——A.B.C.D.
Codeforces Round #627 (Div. 3)A. Yet Another Tetris Problem题目描述Exampleinput431 1 341 1 2 1211 111100outputYESNOYESYES题意思路:就是给定数组是列的底部代码D. Pair of Topics题目描述Exampleinput54 8 2 6 24 5 4 1 3output7input41 3 2 41 3 2 4ou原创 2020-07-21 12:18:52 · 149 阅读 · 0 评论 -
A. Transformation: from A to B(dfs)
A. Transformation: from A to B题目描述Exampleinput2 162outputYES52 4 8 81 162 input4 42outputNO题意思路:给a和b,让通过两种操作从a得到b是否可能,若可能输出YES和几步,及每步得到的数,若不可能,输出NO。两种操作如下:①x2②x10+1采用dfs来解决,每次否有两种选择。*dfs走两条路的同时还要记录每一步得到的数,*需要在两种选择进行下一步dfs之间加上判断是否第一个选择已原创 2020-07-20 17:22:43 · 626 阅读 · 0 评论 -
Codeforces Round #656 (Div. 3)——A.B.C.(D-dfs)
Codeforces Round #656 (Div. 3)A. Three Pairwise Maximums题目描述Exampleinput53 2 3100 100 10050 49 4910 30 201 1000000000 1000000000outputYES3 2 1YES100 100 100NONOYES1 1 1000000000题意:求一组a,b,c三个数,是满足max(a,b)=x,max(a,c)=y,max(b,c)=z,现在给出x原创 2020-07-18 18:47:59 · 144 阅读 · 0 评论 -
Educational Codeforces Round 91 (Rated for Div. 2)——A.B.C.
Educational Codeforces Round 91 (Rated for Div. 2)A. Three Indices题目描述Exampleinput342 1 4 364 6 1 2 5 355 3 1 2 4outputYES2 3 4YES3 5 6NO题意思路:t组输入,每组输入一个n,然后n个数,要求是否再数组内存在,一个数左边有比它小的,右边也有比它小的,若有输出YES并输出三个位置,可能有很多种,任意一个,若不存在,则输出NO。代码#原创 2020-07-13 11:49:37 · 392 阅读 · 0 评论 -
Codeforces Round #655 (Div. 2)——A.B.C.
Codeforces Round #655 (Div. 2)(补题)A. Omkar and Completion题目描述You have been blessed as a child of Omkar. To express your gratitude, please solve this problem for Omkar!An array a of length nn is called complete if all elements are positive and don’t exce原创 2020-07-12 11:49:40 · 358 阅读 · 0 评论 -
Codeforces Round #654 (Div. 2)——D. Grid-00100
## D. Grid-00100题目描述A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers n,k. Construct a grid A with size n×n consisting of integers 0 and 1. The very important condition should be satisfied: the sum o原创 2020-07-11 16:00:40 · 172 阅读 · 0 评论 -
Codeforces Round #654 (Div. 2)——C. A Cookie for You
C. A Cookie for You题目描述Anna is a girl so brave that she is loved by everyone in the city and citizens love her cookies. She is planning to hold a party with cookies. Now she has a vanilla cookies and b chocolate cookies for the party.She invited n guests原创 2020-07-11 15:22:45 · 146 阅读 · 0 评论 -
Codeforces Global Round 9——A.B.C
Codeforces Global Round 9A. Sign Flipping题目描述You are given nn integers a1,a2,…,an, where nn is odd. You are allowed to flip the sign of some (possibly all or none) of them. You wish to perform these flips in such a way that the following conditions hold原创 2020-07-06 17:16:31 · 284 阅读 · 0 评论 -
Codeforces Beta Round #2——A.B.
Codeforces Beta Round #2A. Winner The winner of the card game popular in Berland “Berlogging” is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situa原创 2020-07-04 12:11:16 · 219 阅读 · 0 评论