思维、找规律
文章平均质量分 90
ACM找规律题目题解
Dream Flying Eagle
这个作者很懒,什么都没留下…
展开
-
双向链表练习题(2019牛客国庆集训派对day1)(二叉树)
双向链表练习题(2019牛客国庆集训派对day1)(二叉树)时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536KSpecial Judge, 64bit IO Format: %lld题目描述Bobo 有 n 个列表 L1,L2,…,LnL_1, L_2, \dots, L_nL1,L2,…,Ln.初始时,LiL_iLi仅包含元素...原创 2019-10-01 23:52:21 · 519 阅读 · 0 评论 -
2020 CCPC Wannafly Winter Camp Day1 Div.1&2(I K小数查询)(水题)
2020 CCPC Wannafly Winter Camp Day1 Div.1&2(I K小数查询)(水题)时间限制:C/C++ 6秒,其他语言12秒空间限制:C/C++ 524288K,其他语言1048576K64bit IO Format: %lld题目描述热爱学习刻苦奋斗的九条可怜最近做了很多数据结构题,接触到了 KKK 小数查询这一系列的问题以及线段树的重磅打击这...原创 2020-01-29 11:33:30 · 428 阅读 · 0 评论 -
The World(水题)
The World(水题)judge:HDUOJ 6556source:2018CCPC吉林赛区(重现赛)- 感谢北华大学Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1106Accepted Submission(s): 378...原创 2019-09-09 21:34:37 · 277 阅读 · 0 评论 -
Codeforces Round #618 (Div. 2)(E. Water Balance)(分块)
Codeforces Round #618 (Div. 2)(E. Water Balance)(分块)time limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputjudge: 点我跳转DescriptionThere are nnn w...原创 2020-02-13 11:42:03 · 193 阅读 · 0 评论 -
第三题题解-字符画-第13次CCF计算机职业资格认证考试
第三题-字符画-第13次CCF计算机职业资格认证考试试题编号: 201909-3试题名称: 字符画时间限制: 5.0s内存限制: 512.0MB题解先奉图一张:再放出ACCII码一张 :点我查看ASCII码再放出一些printf函数的打印技巧:C语言中用%输出不同内容不得不说这题还是有不少坑的!题上分别给出了改变前景色和背景色的方法,但是我们只需要用到背景色,...原创 2019-11-16 15:51:28 · 413 阅读 · 1 评论 -
Ivan the Fool and the Probability Theory-Codeforces Round #594 (Div. 2)-C题(dp+思维)
Ivan the Fool and the Probability Theory-Codeforces Round #594 (Div. 2)-C题(dp+思维)time limit per test:1 secondmemory limit per test:512 megabytesinput:standard inputoutput:standard output描述Rece...原创 2019-10-21 00:28:43 · 615 阅读 · 7 评论 -
Layout(POJ No.3169)
Layout(POJ No.3169)POJ 3169#include <iostream>#include <algorithm>using namespace std;#define maxn 10005#define _for(i, a) for(int i = 0; i < (a); i++)#define _rep(i, a, b) fo...原创 2019-10-30 14:03:37 · 121 阅读 · 0 评论 -
C. Minimize The Integer(Educational Codeforces Round 75 (Rated for Div. 2))
C. Minimize The Integer(Educational Codeforces Round 75 (Rated for Div. 2))time limit per test:2 secondsmemory limit per test:256 megabytesinput:standard inputoutput:standard outputDescription...原创 2019-11-03 14:15:19 · 167 阅读 · 0 评论 -
D. Binary String Minimizing(Codeforces Round #598 (Div. 3))(模拟)
D. Binary String Minimizing(Codeforces Round #598 (Div. 3))(模拟)time limit per test:1 secondmemory limit per test:256 megabytesinput:standard inputoutput:standard outputDescriptionYou are given...原创 2019-11-05 00:06:36 · 280 阅读 · 0 评论 -
Just an Old Puzzle(2019杭电多校训练赛第四场-找规律题)
Just an Old Puzzle(2019杭电多校训练赛第四场-找规律题)judge:hduoj 6620source:2019 Multi-University Training Contest 4Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 262144/262144 K (Java/Others)Problem Desc...原创 2019-07-31 23:14:44 · 148 阅读 · 0 评论 -
AND Minimum Spanning Tree(2019杭电多校训练赛第四场-签到题)
AND Minimum Spanning Tree(2019杭电多校训练赛第四场-签到题)judge:hduoj 6614source:2019 Multi-University Training Contest 4Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 131072/131072 K (Java/Others)Proble...原创 2019-07-31 23:06:25 · 142 阅读 · 0 评论 -
2019CCPC秦皇岛站网络赛-1008-Fishing Master(贪心+思维)
Fishing Master(贪心+思维)Problem DescriptionHeard that eom is a fishing MASTER, you want to acknowledge him as your mentor. As everybody knows, if you want to be a MASTER’s apprentice, you should pass t...原创 2019-08-23 19:53:54 · 2097 阅读 · 7 评论 -
题解(HAUT2019级新生周赛(六)-张伟涛专场)
题解(HAUT2019级新生周赛(六)-张伟涛专场)问题 A: 棋盘上的米粒模拟签到题从第一个格子开始放米粒,如果米粒数量为正数,就代表当前位置的格子是可以放上米粒的,放不放满无所谓,维护一个k代表放到第一个格子。#include <iostream>using namespace std;typedef long long LL;LL n;int sol() {...原创 2019-12-10 21:59:58 · 558 阅读 · 0 评论 -
E. Yet Another Division Into Teams(Codeforces Round #598 (Div. 3))(划分数-贪心-模拟)
E. Yet Another Division Into Teams(Codeforces Round #598 (Div. 3))(划分数-贪心-模拟)time limit per test:2 secondsmemory limit per test:256 megabytesinput:standard inputoutput:standard outputDescriptio...原创 2019-11-07 23:29:55 · 230 阅读 · 0 评论 -
C. League of Leesins(Codeforces Round #601 (Div. 2))(模拟+思维)
C. League of Leesins(Codeforces Round #601 (Div. 2))(模拟+思维)time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDescriptionBob is an avid fan o...原创 2019-11-23 16:19:14 · 568 阅读 · 0 评论 -
组合数(2019牛客国庆集训派对day1-B)
组合数(2019牛客国庆集训派对day1)时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536KSpecial Judge, 64bit IO Format: %lld题目描述给出 nnn 和 kkk,求 min{n!k!(n−k)!,1018}\min\{\frac{n!}{k! (n - k)!}, 10^{18}\}min{k!(n−...原创 2019-10-02 00:02:16 · 146 阅读 · 0 评论 -
B. Minimize the Permutation(Codeforces Round #598 (Div. 3))(模拟)
B. Minimize the Permutation(Codeforces Round #598 (Div. 3))(模拟)time limit per test:1 secondmemory limit per test:256 megabytesinput:standard inputoutput:standard outputDescriptionYou are given a...原创 2019-11-04 23:55:35 · 366 阅读 · 0 评论 -
B. Silly Mistake(Codeforces Round #600 (Div. 2))
B. Silly Mistake(Codeforces Round #600 (Div. 2))time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputDescriptionThe Central Company has an offic...原创 2019-11-17 11:42:17 · 356 阅读 · 0 评论 -
Codeforces Round #704 (Div. 2)部分题解(A,B,C,D)
oj: CodeForces题目顺序为倒叙。D. Genius’s Gambitoj: CodeForces题意给定 333 个整数 a,b,ka,b,ka,b,k。找出满足以下条件的两个二进制数 x,yx,yx,y:xxx 和 yyy 的二进制形式都是由 aaa 个 000 和 bbb 个 111 构成。x−yx-yx−y 的二进制形式中有 kkk 个 111 。xxx 和 yyy 没有前导 000 。题解由于 x−yx-yx−y 没有前导 000 限制,所以我们假设 x−yx-原创 2021-02-25 17:53:05 · 256 阅读 · 0 评论 -
2021牛客寒假算法基础集训营6部分题解(A,C,D,E,F,G,H,I,J)
oj: 牛客A 回文括号序列计数oj: 牛客题意询问长度为 nnn 的括号序列的个数。括号序列定义:空串是括号序列。两个括号序列 PPP 和 QQQ 的拼接是括号序列。如果 PPP 是括号序列,’(’+ PPP +’)'是括号序列。题解脑筋急转弯题。一个长度不为0的括号序列的两端字符必定不同,所以左右反转后一定不是括号序列,更不可能与之前相同。代码#include <bits/stdc++.h>#define _for(i, a) for (int i = 0,原创 2021-02-25 11:07:20 · 363 阅读 · 0 评论 -
2020 年第一届辽宁省大学生程序设计竞赛(A,B,C,E,F,G,H,I,J,K)
oj: 牛客A.组队分配(签到题)oj: 牛客题解排序后直接输出。代码#pragma GCC optimize(2)#include <bits/stdc++.h>#define _for(i, a) for(int i = 0, lennn = (a); i < lennn; ++i)#define _rep(i, a, b) for(int i = (a), lennn = (b); i <= lennn; ++i)using namespace st.原创 2021-01-30 19:39:09 · 1426 阅读 · 1 评论 -
Educational Codeforces Round 103 (Rated for Div. 2)部分题解(A,B,C,D)
oj: CodeForces叙述采用倒叙D. Journey(dp)oj: CodeForces题意有 n+1n+1n+1 个点和 nnn 条边组成的一条链,链上的边只能由一个朝向(向左或者向右)。有个旅行者从一个点出发后只能顺着边的朝向移动,不过每当他移动一格,所有边的朝向都会改变(朝左的百年城朝右,朝右的变成朝左)。求出旅行者分别在每一个点出发能够走到的最多的点数。题解定义 dp[i][j][k]dp[i][j][k]dp[i][j][k] :当 iii 为 000 时表示只.原创 2021-01-30 14:38:38 · 239 阅读 · 3 评论 -
Codeforces Round #698 (Div. 2)部分题解(A,B,C,D)
oj: CodeForces叙述采用倒叙。D. Nezzar and Boardoj: CodeForces还在写,稍等片刻C. Nezzar and Symmetric Arrayoj: CodeForces题意aaa 数组是一个由 2n2n2n 个互不相同的整数组成的数组,且每个 aia_iai 都能找到一个 aja_jaj 满足 ai=−aja_i=-a_jai=−aj。ddd 数组是 di=∑j=12n∣ai−aj∣d_i=∑^{2n}_{j=1}|a_i−a_j.原创 2021-01-29 11:02:24 · 1521 阅读 · 11 评论 -
Codeforces Round #696 (Div. 2)部分题解(A,B,C,D)
oj: CodeForces题目解析采用倒叙。D. Cleaningoj: CodeForces题意给你一个包含 nnn 个元素的数组,你可以执行以下操作任意次:选择两个挨着的正整数,使他们分别减一。注意当一个数字减为 000 之后,他旁边的两个数字并不相邻。你可以选择在开始前做一次额外的操作:选择两个相邻的数字使之互换位置。判断是否有可能把数组全部减为 000。题解假设数组为 a1,a2,...,ana_1,a_2,...,a_na1,a2,...,an,当消去 a1a.原创 2021-01-21 20:13:20 · 228 阅读 · 0 评论 -
Educational Codeforces Round 102 (Rated for Div. 2)部分题解(A,B,C,D)
jusge: CodeForces题解的分析顺序采用倒叙。D. Programjudge: CodeForces题意给你一个初始值为 000 的 xxx,和由若干个+和-组成的序列,+代表下一轮 xxx 的值+1,-代表下一轮 xxx 的值-1。有 mmm 次操作,每次操作给出一段区间 [l,r][l,r][l,r],求出忽略 [l,r][l,r][l,r] 区间的序列执行过程中 xxx 的不同状态的数量。例如当序列为--+时,xxx 的取值是0,-1,-2,-1,一共有 333 种状.原创 2021-01-15 14:19:27 · 313 阅读 · 0 评论 -
E. Dog Snacks(Codeforces Round #688 (Div. 2))
E. Dog Snacks(Codeforces Round #688 (Div. 2))time limit per test:3 secondsmemory limit per test:512 megabytesjudge: CF题意有一个 nnn 个节点的树,每个节点都有一些食物,Badugi要吃到所有节点的食物。一个节点的食物被吃掉后不再有食物。Badugi只能闻到距离不超过 kkk 的食物。Badugi吃到所有食物后需要返回到根节点(编号 111 ),同样只有1距离Badugi不原创 2020-12-07 19:19:49 · 337 阅读 · 2 评论 -
思维训练
K-Bag(2020牛客多校第6场K)时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lldOJ:牛客题目描述A sequence is called kkk-bag, if and only if it is put in order by some (maybe one) permutations of 111 to kkk. For example, 1,2,3,2,1,3,3,2,1 is a v原创 2020-11-19 00:24:03 · 240 阅读 · 0 评论 -
2020杭电多校第10场题解
Time limit: 6000 msMemory limit: 262144 kBJudge:VJudgeHDUOJProblem DescriptionFor a given permutation a1,a2,⋯,ana1,a2,⋯,ana1,a2,⋯,an of length nnn, we defined the neighbor sequence bbb of aaa, the length of which is n−1n−1n−1, as following:y = \le.原创 2020-11-02 20:44:35 · 401 阅读 · 0 评论 -
E Groundhog Chasing Death(2020牛客暑期多校训练营(第九场))(思维+费马小定理+质因子分解)
E Groundhog Chasing Death(2020牛客暑期多校训练营(第九场))(思维+费马小定理+素数)链接:https://ac.nowcoder.com/acm/contest/5674/E来源:牛客网时间限制:C/C++ 2秒,其他语言4秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述As we all know,“Groundhog chasing death” means “GCD”,while “GCD”原创 2020-08-08 21:33:30 · 354 阅读 · 2 评论 -
I-Paperfolding(2020 Multi-University Training Contest 5)(数学+找规律)
I-Paperfolding(2020 Multi-University Training Contest 5)(数学+找规律)Time limit:1000 msMemory limit:131072 kBDescriptionThere is a piece of paper in rectangular shape with sufficient length and width (lay flat on the table). Execute an operation instruction原创 2020-08-06 19:04:27 · 224 阅读 · 0 评论 -
2020牛客暑期多校训练营(第六场)(线性代数+找规律)
2020牛客暑期多校训练营(第六场)(线性代数+找规律)时间限制:C/C++ 2秒,其他语言4秒空间限制:C/C++ 524288K,其他语言1048576K64bit IO Format: %lldjudge:牛客题目描述Roundgod is obsessive about linear algebra. Let A={0,1}A=\{0,1\}A={0,1}, everyday she will generate a binary vector randomly in AnA^nAn. N转载 2020-07-30 11:15:25 · 313 阅读 · 0 评论 -
E Two Matchings(2020牛客暑期多校训练营(第三场))(动态规划+找规律)
E Two Matchings(2020牛客暑期多校训练营(第三场))(动态规划+找规律)时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lldjudge:牛客题库题目描述A permutation of length n is an array p=[p1,p2,…,pn]p=[p_1, p_2, \ldots, p_n]p=[p1,p2,…,pn], which contains every int原创 2020-07-19 12:14:00 · 298 阅读 · 0 评论 -
打字机(找规律)
打字机(找规律)单点时限: 1.0 sec内存限制: 512 MB描述Cuber QQ 长期在网络上与他人对线,一天,他发明了一台神奇的打字机。这台打字机只能处理由 a,b,X 构成的字符串。具体来说,打字机能够执行如下三种操作。操作:将任意一个 X 替换为 aX 。操作:将任意一个 X 替换为 aXbX 。操作:删除任意一个 X 。打字机启动时,屏幕上有且仅有一个 X 。现在 Cuber QQ 想要打出一个仅包含 a , b 的字符串 s 。但是他有选择困难症,注意到,操作 1 和操作原创 2020-07-18 11:36:12 · 461 阅读 · 0 评论 -
C-Cover the Tree(2020牛客暑期多校训练营(第二场))(找规律)
C-Cover the Tree(2020牛客暑期多校训练营(第二场))(找规律)时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288KSpecial Judge, 64bit IO Format: %lld链接:https://ac.nowcoder.com/acm/contest/5667/C来源:牛客网题目描述Given an unrooted tree, you should choose the minimum number of cha原创 2020-07-16 14:57:09 · 216 阅读 · 0 评论 -
Heshen‘s Account Book(HihoCoder - 1871)(找规律)
Time limit1000 msMemory limit524288 kBjudge:vjudgehihocoder描述Heshen was an official of the Qing dynasty. He made a fortune which could be comparable to a whole country’s wealth by corruption. So he was known as the most corrupt official in Chinese his原创 2020-07-15 15:07:19 · 189 阅读 · 0 评论 -
B - Eight II(搜索+康拓编码+思维)
B - Eight II(康拓编码+思维)Time limit2000 msMemory limit65536 kBjudge:vjudgeDescriptionEight-puzzle, which is also called “Nine grids”, comes from an old game.In this game, you are given a 3 by 3 board and 8 tiles. The tiles are numbered from 1 to 8 and ea原创 2020-05-20 15:56:17 · 260 阅读 · 0 评论 -
J. Prime Game(The 2018 ACM-ICPC Asia Nanjing)(思维+线筛)
J. Prime Game(The 2018 ACM-ICPC Asia Nanjing)(思维+线筛)Time limit: 2000 msMemory limit: 1048576 kBjudge:vjudgeDescriptionGiven a suqence of nnn integers aia_iai .Let mul(l,r)mul(l, r)mul(l,r) = ∏i...原创 2020-05-05 22:43:49 · 305 阅读 · 0 评论 -
Sequence in the Pocket(2019浙江省省赛)(找规律)
Sequence in the Pocket(找规律)Time Limit: 2000 msMemory Limit: 65536 KBDescriptionDreamGrid has just found an integer sequence a1,a2,…,ana_1, a_2, \dots, a_na1,a2,…,an in his right pocket. As Drea...原创 2020-04-17 20:59:50 · 318 阅读 · 0 评论 -
D - Magic Multiplication(The 2018 ACM-ICPC Asia Qingdao Regional Contest)(找规律+构造)
D - Magic Multiplication(The 2018 ACM-ICPC Asia Qingdao Regional Contest)(找规律+构造)Time limit:1000 msMemory limit:65536 kBjudge:ZOJ 4061vjudgeDescriptionBaoBao is now learning a new binary operat...原创 2020-04-11 14:58:45 · 513 阅读 · 2 评论 -
F - Tournament(The 2018 ACM-ICPC Asia Qingdao Regional Contest)(找规律+构造)
F - Tournament(The 2018 ACM-ICPC Asia Qingdao Regional Contest)(找规律+构造)Time limit:1000 msMemory limit:65536 kBjudge:ZOJ - 4063vjudgeDescriptionDreamGrid, the king of Gridland, is making a knigh...原创 2020-04-08 13:47:25 · 677 阅读 · 0 评论