
思维题
文章平均质量分 65
black-hole6
这个作者很懒,什么都没留下…
展开
-
【优快云】竞赛第7期题解&建议
已知存在集合A包含n个整数,从1到n。存在m个整数a[1…在集合A中去除这m个整数的的倍数。输出集合中包含的元素的个数。给定两组长度为n的二进制串,请问有多少种方法在第一个串中交换两个不同位置上的数字,使得这两个二进制串“或”的 结果发生改变?用马拉车算法求一下最长回文子串的长度即可,很经典。思路:统计一下会产生数值变化的情况即可。思路:经典二进制枚举+gcd+lcm。按照既定的顺序进行排序即可。原创 2022-10-20 00:14:57 · 519 阅读 · 4 评论 -
建通道(思维题)
链接:https://ac.nowcoder.com/acm/contest/3003/I来源:牛客网时间限制:C/C++ 3秒,其他语言6秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述在无垠的宇宙中,有 n 个星球,第 i 个星球有权值 viv_ivi。由于星球之间距离极远,因此想在有限的时间内在星际间旅...原创 2020-02-06 18:29:38 · 579 阅读 · 0 评论 -
wzoi(栈模拟)
链接:https://ac.nowcoder.com/acm/contest/332/I来源:牛客网 题目描述bleaves 最近在 wzoi 上面做题。wzoi 的题目有两种,一种是 noip 题,一种是省选题。bleaves 的做题方式很特别。每一天,她可能会看一道题目,这时她会选择题目种类,然后 wzoi 会在选定种类中随机扔给她一道她还没看过的题,她会把这道题看一遍,然后存...原创 2019-02-02 19:11:08 · 1177 阅读 · 0 评论 -
分糖果(模拟)
标题:分糖果 有n个小朋友围坐成一圈。老师给每个小朋友随机发偶数个糖果,然后进行下面的游戏: 每个小朋友都把自己的糖果分一半给左手边的孩子。 一轮分糖后,拥有奇数颗糖的孩子由老师补给1个糖果,从而变成偶数。 反复进行这个游戏,直到所有小朋友的糖果数都相同为止。 你的任务是预测在已知的初始糖果情形下,老师一共需要补发多少个糖果。【格式要求】...原创 2019-01-31 22:25:13 · 319 阅读 · 0 评论 -
处女座的约会(思维)
链接:https://ac.nowcoder.com/acm/contest/329/I来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述处女座放完了"高利贷",拿到了不少的资金,又可以和小姐姐约会啦!(之前不还是攒钱打比赛的吗)现在处女座拿到了一份宁波市旅游地...原创 2019-01-26 17:53:47 · 402 阅读 · 0 评论 -
环形地铁(前缀和)
Description 有一环形地铁,一共有nn站,编号1-n1−n。正向行驶地铁会按照1->2->3->⋯->n->1的方向行驶反向则按照1->n->⋯->3->2->1的方向行驶。给定相邻两站之间的地铁行驶时间(正向、反向时间相同),现在有mm组询问,每次询问从第xx站到第yy站的最短时间。Input ...原创 2019-01-25 21:31:57 · 573 阅读 · 0 评论 -
处女座的测验(一)(素数筛+思维)
链接:https://ac.nowcoder.com/acm/contest/327/H来源:牛客网 题目描述处女座进行了一场c语言的考试,要求很简单,输出2000个正整数,并且满足以下条件:1. 任意两个数互质2. 任意两个数x,y,满足,其中为n的因子的个数 举例:6的因子有1,2,3,6,所以τ(6)=4τ(6)=4输入描述:本题没有...原创 2019-01-25 12:02:48 · 345 阅读 · 0 评论 -
Codeforces Round #532 (Div. 2)- C(公式计算)
NN is an experienced internet user and that means he spends a lot of time on the social media. Once he found the following image on the Net, which asked him to compare the sizes of inner circles:I...原创 2019-01-14 23:10:58 · 756 阅读 · 0 评论 -
Codeforces Round #532 (Div. 2)- B(思维)
Arkady coordinates rounds on some not really famous competitive programming platform. Each round features nn problems of distinct difficulty, the difficulties are numbered from 11 to nn.To hold a ro...原创 2019-01-14 23:06:36 · 421 阅读 · 0 评论 -
Codeforces Round #532 (Div. 2)- A(思维)
This morning, Roman woke up and opened the browser with nn opened tabs numbered from 11 to nn. There are two kinds of tabs: those with the information required for the test and those with social netwo...原创 2019-01-14 23:03:53 · 416 阅读 · 0 评论 -
Codeforces-C-Nice Garland(枚举+暴力)
You have a garland consisting of nn lamps. Each lamp is colored red, green or blue. The color of the ii-th lamp is sisi ('R', 'G' and 'B' — colors of lamps in the garland).You have to recolor some l...原创 2019-01-24 11:55:58 · 680 阅读 · 0 评论 -
Codeforces-B-Divisors of Two Integers(思维技巧)
Recently you have received two positive integer numbers xx and yy. You forgot them, but you remembered a shuffled list containing all divisors of xx (including 11 and xx) and all divisors of yy (inclu...原创 2019-01-24 11:53:04 · 776 阅读 · 2 评论 -
彪神666(暴力即可)
链接:https://ac.nowcoder.com/acm/contest/318/L来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述在国外,666代表魔鬼,777代表上帝。所以牛逼的彪神就非常不喜欢6这个数字。有一天彪神突发奇想,,他想求一些书与6无关...原创 2018-12-23 17:01:14 · 380 阅读 · 0 评论 -
被打脸的潇洒哥(推递推式)
链接:https://ac.nowcoder.com/acm/contest/318/M来源:牛客网 在一次青青草原ACM个人赛中,潇洒哥被喜洋洋以30s罚时压制,委屈的当了个第二。潇洒哥蹲在角落说出了他的口头禅,并画起了圈圈。 突然,他想出了一个有趣的题目,跑去给喜洋洋做。喜洋洋看到题目后懵逼了,但是看到潇洒哥脸上欠揍的笑容就不爽,暗想一定要做出来狠狠的打潇洒哥的脸。 ...原创 2018-12-23 16:59:01 · 449 阅读 · 0 评论 -
送气球.jpg(模拟)
链接:https://ac.nowcoder.com/acm/contest/318/A来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述 ACM-ICPC程序设计大赛是大学级别最高的脑力竞赛,素来被冠以"程序设计的奥林匹克"的尊称。大赛至今已有近40年...原创 2018-12-23 16:53:01 · 360 阅读 · 0 评论 -
Codeforces Round #529 -C- Powers Of Two(二进制拆分)
A positive integer xx is called a power of two if it can be represented as x=2yx=2y, where yy is a non-negative integer. So, the powers of two are 1,2,4,8,16,…1,2,4,8,16,….You are given two positive...原创 2018-12-28 16:30:50 · 840 阅读 · 0 评论 -
Olesya and Rodion (思维)
Olesya loves numbers consisting of n digits, and Rodion only likes numbers that are divisible by t. Find some number that satisfies both of them.Your task is: given the n and t print an integer stri...原创 2019-02-02 20:37:13 · 409 阅读 · 0 评论 -
Codeforces-B-Game with string(模拟栈)
Two people are playing a game with a string ss, consisting of lowercase latin letters.On a player's turn, he should choose two consecutive equal letters in the string and delete them.For example, ...原创 2019-01-23 13:00:27 · 475 阅读 · 0 评论 -
HDU第四场1003(构造)
更新在了博客园https://www.cnblogs.com/Staceyacm/p/11280622.html原创 2019-08-01 09:44:03 · 350 阅读 · 0 评论 -
兔子的区间密码(思维)
链接:https://ac.nowcoder.com/acm/contest/543/C来源:牛客网时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K64bit IO Format: %lld题目描述有一只可爱的兔子被困在了密室了,密室里有两个数字,还有一行字:只有解开密码,才能够出去。可爱的兔子摸索了好久,发现密室里的两个数...原创 2019-04-24 19:52:09 · 388 阅读 · 0 评论 -
CodeForces - 556C-Case of Matryoshkas(思维)
Andrewid the Android is a galaxy-famous detective. He is now investigating the case of vandalism at the exhibition of contemporary art.The main exhibit is a construction ofnmatryoshka dolls that c...原创 2019-04-24 14:56:09 · 338 阅读 · 0 评论 -
昂贵的聘礼(枚举区间+最短路)
年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:"嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶球,那么只要5000金币就行了。"探险家就跑到大祭司那里,向他要求皮袄或水晶球,大祭司要他用金币来换,或者替他弄来其他的东西,...原创 2019-04-26 09:39:32 · 302 阅读 · 0 评论 -
ZOJ - 3939 The Lucky Week(日期循环节+思维)
Edward, the headmaster of the Marjar University, is very busy every day and always forgets the date.There was one day Edward suddenly found that if Monday was the 1st, 11th or 21st day of that month...原创 2019-04-11 23:36:55 · 340 阅读 · 0 评论 -
Rebranding(模拟+思维)
The name of one small but proud corporation consists ofnlowercase English letters. The Corporation has decided to try rebranding— an active marketing strategy, that includes a set of measures to ch...原创 2019-04-08 17:27:33 · 411 阅读 · 0 评论 -
Largest Submatrix of All 1’s(思维+单调栈)
Given am-by-n(0,1)-matrix, of all its submatrices of all 1’s which is the largest? Bylargestwe mean that the submatrix has the most elements.InputThe input contains multiple test cases. Each t...原创 2019-04-07 22:48:04 · 306 阅读 · 0 评论 -
CSL 的字符串(思维+STL操作)
链接:https://ac.nowcoder.com/acm/contest/551/D来源:牛客网时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 524288K,其他语言1048576K64bit IO Format: %lld题目描述CSL 以前不会字符串算法,经过一年的训练,他还是不会……于是他打算向你求助。给定一个字符串,只含有可打印字符,通过删...原创 2019-03-31 16:50:21 · 331 阅读 · 0 评论 -
Magic Odd Square (思维+构造)
Find ann × nmatrix with different numbers from1ton2, so the sum in each row, column and both main diagonals are odd.InputThe only line contains odd integern(1 ≤ n ≤ 49).OutputPrintnli...原创 2019-03-12 16:17:51 · 475 阅读 · 0 评论 -
Marlin (思维)
The city of Fishtopia can be imagined as a grid of44rows and anoddnumber of columns. It has two main villages; the first is located at the top-left cell(1,1)(1,1), people who stay there love fish...原创 2019-03-12 16:14:05 · 427 阅读 · 0 评论 -
Fountains(非线段树版(主要是不太会用))
Arkady plays Gardenscapes a lot. Arkady wants to build two new fountains. There are n available fountains, for each fountain its beauty and cost are known. There are two types of money in the game: co...原创 2019-02-25 21:25:32 · 634 阅读 · 0 评论 -
Sasha and a Bit of Relax(前缀异或和+二维数组+思维)
Sasha likes programming. Once, during a very long contest, Sasha decided that he was a bit tired and needed to relax. So he did. But since Sasha isn't an ordinary guy, he prefers to relax unusually. D...原创 2019-02-17 14:47:29 · 437 阅读 · 0 评论 -
CodeForces - 1110C-Meaningless Operation(打表找规律)
Can the greatest common divisor and bitwise operations have anything in common? It is time to answer this question.Suppose you are given a positive integer aa. You want to choose some integer bb fro...原创 2019-02-08 11:40:18 · 414 阅读 · 0 评论 -
Codeforces-C-Grid game(思维)
You are given a 4x4 grid. You play a game — there is a sequence of tiles, each of them is either 2x1 or 1x2. Your task is to consequently place all tiles from the given sequence in the grid. When tile...原创 2019-01-23 13:06:05 · 1057 阅读 · 0 评论 -
勇气获得机(逆向思维)
链接:https://ac.nowcoder.com/acm/contest/315/B来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K64bit IO Format: %lld题目描述妞妞听说Nowcoder Girl女生编程挑战赛要开始了, 但是她没有足够的勇气报名参加, 牛牛为了帮助妞妞,给她准备一台勇气获得机...原创 2018-12-11 21:42:28 · 698 阅读 · 0 评论 -
CodeForces - 1004A-Sonya and Hotels(思维)
Sonya decided that having her own hotel business is the best way of earning money because she can profit and rest wherever she wants.The country where Sonya lives is an endless line. There is a city...原创 2018-12-17 21:38:51 · 316 阅读 · 0 评论 -
CodeForces - 1003-B-Binary String Constructing (规律+模拟)
You are given three integers aa, bb and xx. Your task is to construct a binary string ssof length n=a+bn=a+b such that there are exactly aa zeroes, exactly bb ones and exactly xx indices ii (where 1≤i...原创 2018-12-17 21:02:35 · 423 阅读 · 0 评论 -
Polycarp's Pockets(思维)
Polycarp has nn coins, the value of the ii-th coin is aiai. Polycarp wants to distribute all the coins between his pockets, but he cannot put two coins with the same value into the same pocket.For e...原创 2018-12-14 18:02:00 · 273 阅读 · 0 评论 -
1060 爱丁顿数 (25 分)(思维)
英国天文学家爱丁顿很喜欢骑车。据说他为了炫耀自己的骑车功力,还定义了一个“爱丁顿数” E ,即满足有 E 天骑车超过 E 英里的最大整数 E。据说爱丁顿自己的 E 等于87。现给定某人 N 天的骑车距离,请你算出对应的爱丁顿数 E(≤N)。输入格式:输入第一行给出一个正整数 N (≤105),即连续骑车的天数;第二行给出 N 个非负整数,代表每天的骑车距离。输出格式:在一...原创 2018-12-19 17:00:54 · 268 阅读 · 0 评论 -
Codeforces Round #527-D1. Great Vova Wall (Version 1)(思维+栈)
time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVova's family is building the Great Vova Wall (named by Vova himself). Vova's pare...原创 2018-12-19 16:31:36 · 709 阅读 · 2 评论 -
Codeforces Round #527 -A. Uniform String(思维)
time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two integers n and k.Your task is to construct such a string ss of ...原创 2018-12-19 16:06:50 · 485 阅读 · 0 评论 -
Ehab and subtraction(思维题)
time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou're given an array aa. You should repeat the following operation kk times: find ...原创 2018-12-13 15:03:55 · 357 阅读 · 0 评论