
---- 经典思维题 ----
nobleman__
加油王先生
展开
-
小米OJ 有多少个公差为 2 的等差数列【思维】
序号:#31难度:有挑战时间限制:1000ms内存限制:10M描述给出一个正整数N(2<= N <=10000000),统计有多少公差为2的正整数等差数列,使得数列的和为N。举例: 正整数 15,可以写为 15 和 3,5,7 两个等差数列。 其中 15 自身就是一个等差数列,3+5+7=15 也是一个符合条件的等差数列,所以输出为 2,表示有两个符合条件的等差数列。请注...原创 2019-04-02 19:47:24 · 602 阅读 · 0 评论 -
codeforces742 B. Arpa’s obvious problem and Mehrdad’s terrible solution 【思维 + 亦或】
B. Arpa’s obvious problem and Mehrdad’s terrible solutiontime limit per test1 second memory limit per test256 megabytesThere are some beautiful girls in Arpa’s land as mentioned before.Once Arp原创 2018-02-02 17:41:05 · 453 阅读 · 0 评论 -
codeforces 913 C. Party Lemonade【思维贪心】
C. Party Lemonadetime limit per test1 second memory limit per test256 megabytesA New Year party is not a New Year party without lemonade! As usual, you are expecting a lot of guests, and buying lemona原创 2018-01-09 10:55:33 · 1877 阅读 · 0 评论 -
codeforces 913 C Party Lemonade 【思维贪心】
C. Party Lemonadetime limit per test1 second memory limit per test256 megabytesA New Year party is not a New Year party without lemonade! As usual, you are expecting a lot of guests, and buying l原创 2019-11-07 15:06:24 · 411 阅读 · 0 评论 -
codeforces 913 B. Christmas Spruce 【思维】
B. Christmas Sprucetime limit per test1 second memory limit per test256 megabytesConsider a rooted tree. A rooted tree has one special vertex called the root. All edges are directed from the root原创 2018-01-09 01:56:12 · 1364 阅读 · 0 评论 -
牛客练习赛10 B栈和排序【思维】
题目描述 给你一个1->n的排列和一个栈,入栈顺序给定 你要在不打乱入栈顺序的情况下,对数组进行从大到小排序 当无法完全排序时,请输出字典序最大的出栈序列输入描述:第一行一个数n 第二行n个数,表示入栈的顺序,用空格隔开,结尾无空格输出描述:输出一行n个数表示答案,用空格隔开,结尾无空格示例1输入5 2 1 5 3 4输出5 4 3 1 2说明2入栈;1入栈;5入栈;5出栈;3入栈;4入栈;原创 2018-01-13 11:43:02 · 1362 阅读 · 2 评论 -
2017.12.25 LeetCode 645. Set Mismatch 【思维查找】
645. Set MismatchDescriptionThe set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to another number in the set, which原创 2017-12-25 22:47:19 · 358 阅读 · 0 评论 -
2017年西南民族大学程序设计竞赛-网络同步赛 A 星图【思维维护】
A 星图题目描述现在有一个N*M的矩形星图。其中包括恒星和黑洞。恒星可以向上、下、左、右发射光束,且允许光束从其中穿过;黑洞会吸收所有经过的光束。 若一颗恒星向上、下、左、右发射光束,你能告诉我,该光束能否避免被黑洞吸收,进入星图之外的区域么?输入描述:单组输入。第一行三个正整数N,M,Q(1 <= N,M <= 1000,1 <= Q <= 1000000),分别表示矩阵的行列,以及询问的原创 2017-12-30 17:41:45 · 514 阅读 · 0 评论 -
Wannafly挑战赛6 E 双拆分数【思维】
双拆分数题目描述对于一个数字串 s,若能找到一种将其分成左右两个非空部分 s1,s2 的方案,使得: 1、s1,s2 均无前导零 2、存在两个正整数 a,b,使得 b 整除 a,且 a/b=s1, a*b=s2 那么我们记这是一个合法的分法。特别地,如果一个串有两个或更多个不同的合法的分法,那么我们称这个数字串是双拆分数字串。 给定一个 n,要求构造一个长度恰为 n 的双拆分原创 2017-12-25 17:04:35 · 483 阅读 · 0 评论 -
Wannafly挑战赛6 C 逆序对【找规律+详细图解】
逆序对题目描述求所有长度为n的01串中满足如下条件的二元组个数: 设第i位和第j位分别位ai和aj(i输入描述:输入一个n。输出描述:输出答案对1e9+7取模示例1输入3输出6说明备注:n<=1018n <= 10^{18}题意: 略分析: 正解: 考虑每一位为0的贡献,设当前为第i位,当前则有i-1位,即2i−12^{i-1}个数,根据0和1的个数应该相同,那么1的个数为这些数总数的一半,即原创 2017-12-25 15:31:54 · 1464 阅读 · 1 评论 -
Wannafly挑战赛9 C 列一列【思维取模 + 大数】
题目描述 小W在计算一个数列{An},其中A1=1,A2=2,An+2=An+1+An。尽管他计算非常精准,但很快他就弄混了自己的草稿纸,他找出了一些他计算的结果,但他忘记了这些都是数列中的第几项。输入描述:每行包括数列中的一项Ak(k总行数T输出描述:对于每一项Ak,输出一行包括一个正整数k表示输入中数是数列的第几项。示例1输入2 3 5 8 13输原创 2018-02-03 11:29:19 · 1027 阅读 · 0 评论 -
HDU - 1018 - Big Number 【千年老题 - 斯特林公式】
Big NumberTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 39262 Accepted Submission(s): 19105Problem DescriptionIn many application原创 2017-11-09 20:45:20 · 542 阅读 · 0 评论 -
codeforces771 A. Bear and Friendship Condition 【并查集】
A. Bear and Friendship Conditiontime limit per test1 second memory limit per test256 megabytesBear Limak examines a social network. Its main functionality is that two members can become friends (...原创 2018-04-09 21:30:20 · 523 阅读 · 0 评论 -
codeforces554 C. Kyoya and Colored Balls【组合数 + 思维 + 阶乘逆元】
C. Kyoya and Colored Ballstime limit per test2 seconds memory limit per test256 megabytesKyoya Ootori has a bag with n colored balls that are colored with k different colors. The colors are label...原创 2018-03-22 21:56:04 · 326 阅读 · 0 评论 -
codeforces954 C. Matrix Walk【思维】
C. Matrix Walktime limit per test1 second memory limit per test256 megabytesThere is a matrix A of size x × y filled with integers. For every , Ai, j = y(i - 1) + j. Obviously, every integer fro...原创 2018-03-22 16:57:40 · 1475 阅读 · 2 评论 -
AtCoder Beginner Contest 088 C Takahashi's Information 【思维枚举】
C - Takahashi’s InformationTime limit : 2sec / Memory limit : 256MB Score: 300 pointsProblem StatementWe have a 3×3 grid. A number ci,j is written in the square (i,j), where (i,j) denotes the...原创 2018-02-18 21:54:58 · 486 阅读 · 0 评论 -
codeforces689 A. Mike and Cellphone【模拟 + 思维】
A. Mike and Cellphonetime limit per test1 second memory limit per test256 megabytesWhile swimming at the beach, Mike has accidentally dropped his cellphone into the water. There was no worry as h...原创 2018-02-13 17:46:22 · 451 阅读 · 0 评论 -
codeforces268 B. Buttons【找规律】
B. Buttonstime limit per test1 second memory limit per test256 megabytesManao is trying to open a rather challenging lock. The lock has n buttons on it and to open it, you should press the button...原创 2018-02-11 21:39:49 · 548 阅读 · 0 评论 -
codeforces230 B. T-primes 【思维 + 打表】
B. T-primestime limit per test2 seconds memory limit per test256 megabytesWe know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we’ll call ...原创 2018-02-11 20:58:34 · 543 阅读 · 0 评论 -
codeforces918C 917A The Monster 【贪心 + 思维枚举】
C. The Monstertime limit per test1 second memory limit per test256 megabytesAs Will is stuck in the Upside Down, he can still communicate with his mom, Joyce, through the Christmas lights (he can原创 2018-01-30 12:52:52 · 1531 阅读 · 2 评论 -
51NOD 1995 三子棋 【思维打表+图解】
1995 三子棋 题目来源: syu校赛 基准时间限制:1 秒 空间限制:131072 KB小的时候大家一定玩过“井”字棋吧。也就是在九宫格中,只要任意行、列,或者任意连续对角线上面出现三个相同的,就能获胜。现在小明和小花也在玩三子棋,但是他们不是在九宫格里,而是在3×4的格子里面。现在小明先下,但是他知道小花这个人很聪明,他想知道第一步下在哪一个地方最合适,你能帮帮他吗?Input第一行输入一原创 2017-12-22 16:11:27 · 5330 阅读 · 2 评论 -
HDU 5690 All X 【思维快速幂】
All XTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 2577 Accepted Submission(s): 1070Problem DescriptionF(x,m) 代表一个全是由数字x组成的m位数字。请计算,以下式子是否原创 2017-12-14 09:25:07 · 337 阅读 · 0 评论 -
LightOJ 1197 - Help Hanzo 【思维找素数 -> 区间素数筛选】
1197 - Help HanzoTime Limit: 2 second(s) Memory Limit: 32 MBAmakusa, the evil spiritual leader has captured the beautiful princess Nakururu. The reason behind this is he had a little problem with Hanzo原创 2017-12-12 20:13:59 · 415 阅读 · 0 评论 -
HDU - 5015 - 233 Matrix【思维+矩阵快速幂】
233 MatrixIn our daily life we often use 233 to express our feelings. Actually, we may say 2333, 23333, or 233333 … in the same meaning. And here is the question: Suppose we have a matrix called 233 ma原创 2017-10-26 18:37:51 · 552 阅读 · 0 评论 -
HDU - 6030 - Happy Necklace 【矩阵快速幂+思维+图解分析】
HDU - 6030 - Happy NecklaceLittle Q wants to buy a necklace for his girlfriend. Necklaces are single strings composed of multiple red and blue beads. Little Q desperately wants to impress his girlfri原创 2017-10-25 19:10:21 · 621 阅读 · 0 评论 -
2017CCPC秦皇岛现场赛 - M - Safest Buildings 【几何 + 思维】
Safest BuildingsTime Limit: 1 Second Memory Limit: 65536 KBPUBG is a multiplayer online battle royale video game. In the game, up to one hundred players parachute onto an island and scavenge for w原创 2017-11-02 14:22:18 · 1212 阅读 · 0 评论 -
2017.10.24 LeetCode 88. Merge Sorted Array 【思维呀】
88. Merge Sorted ArrayDescriptionGiven two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:You may assume that nums1 has enough space (size that is greater or equ原创 2017-10-24 20:15:57 · 436 阅读 · 0 评论 -
HDU - 5806 - NanoApe Loves Sequence Ⅱ 【思维尺取】
NanoApe Loves Sequence ⅡTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/131072 K (Java/Others) Total Submission(s): 1849 Accepted Submission(s): 794Problem DescriptionNanoApe, the Re原创 2017-10-15 20:57:55 · 518 阅读 · 0 评论 -
HDU - 1937 - Finding Seats【思维尺取】
Finding SeatsTime Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 720 Accepted Submission(s): 217Problem DescriptionA group of K friends is going原创 2017-10-14 21:17:32 · 1271 阅读 · 2 评论 -
2017秦皇岛 - ICPC - E - String of CCPC 【string的一些简单运用,思维】
String of CCPCTime Limit: 1 Second Memory Limit: 65536 KBBaoBao has just found a string SS of length nn consisting of ‘C’ and ‘P’ in his pocket. As a big fan of the China Collegiate Programming原创 2017-10-31 20:20:46 · 1813 阅读 · 0 评论 -
2017秦皇岛ICPC - C - Crusaders Quest【思维+暴力】
Crusaders QuestTime Limit: 1 Second Memory Limit: 65536 KBCrusaders Quest is an interesting mobile game. A mysterious witch has brought great darkness to the game world, and the only hope for your原创 2017-10-30 21:21:26 · 2209 阅读 · 0 评论 -
codeforces - 877C - Slava and tanks 【找规律呀找规律】
C. Slava and tankstime limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output.Slava plays his favorite game “Peace Lightning”. Now he is flying a bomber原创 2017-10-28 14:56:30 · 737 阅读 · 0 评论 -
HDU - 1865 - 1sting【经典水题 之 斐波那契】
1stingTime Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 6310 Accepted Submission(s): 2451Problem DescriptionYou will be given a string which o原创 2017-11-14 16:08:31 · 421 阅读 · 0 评论 -
51NOD - 贪心算法入门 - 活动安排问题 之 二【简单贪心 + 思维】
题目有若干个活动,第i个开始时间和结束时间是[Si,fi),活动之间不能交叠,要把活动都安排完,至少需要几个教室?输入第一行一个正整数n (n <= 10000)代表活动的个数。 第二行到第(n + 1)行包含n个开始时间和结束时间。 开始时间严格小于结束时间,并且时间都是非负整数,小于1000000000输出一行包含一个整数表示最少教室的个数。输入示例3 1 2 3 4 2 9输出示例2原创 2017-11-20 20:41:00 · 539 阅读 · 0 评论 -
codeforces 897 B. Chtholly's request【构造回文数+递推】
B. Chtholly’s requesttime limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output— Thanks a lot for today. — I experienced so many great things.— You ga原创 2017-12-04 13:31:32 · 1334 阅读 · 0 评论 -
第九届ACM趣味程序设计竞赛第二场(正式赛) B - 绿帽自动机【思维】
B - 绿帽自动机Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others)绿人无数的绿帽侠决定金盆洗手啦! 由于绿帽侠后继无人,按照祖祖辈辈的祖训,绿帽侠要把位置传给这个王国里绿帽最少的那个人。 但是,绿帽侠曾记得那个被绿的晚上,而那个人,还在王国里潇潇洒洒。 “当然是选择 不 原谅他原创 2017-12-04 13:14:47 · 2270 阅读 · 0 评论 -
AtCoder Beginner Contest 081 D - Non-decreasing 【思维移位】
D - Non-decreasingTime limit : 2sec / Memory limit : 256MBScore : 600 pointsProblem StatementSnuke has an integer sequence, a, of length N. The i-th element of a (1-indexed) is ai.He can perform the fo原创 2017-12-11 13:48:15 · 561 阅读 · 0 评论 -
51NOD - 1596 搬货物 | CF587 A. Duff and Weight Lifting【思维+二进制】
1596 搬货物基准时间限制:1 秒 空间限制:131072 KB 现在有n个货物,第i个货物的重量是 2wi 。每次搬的时候要求货物重量的总和是一个2的幂。问最少要搬几次能把所有的货物搬完。 样例解释: 1,1,2作为一组。 3,3作为一组。Input单组测试数据。 第一行有一个整数n (1≤n≤10^6),表示有几个货物。 第二行有n个整数 w1,w2,…,wn,(0≤wi≤10^6)原创 2017-11-22 17:50:16 · 587 阅读 · 0 评论 -
51NOD - 1381 1381 硬币游戏【思维+数学期望】
1381 硬币游戏有一个简单但是很有趣的游戏。在这个游戏中有一个硬币还有一张桌子,这张桌子上有很多平行线(如下图所示)。两条相邻平行线之间的距离是1,硬币的半径是R,然后我们来抛硬币到桌子上,抛下之后硬币有时候会和一些直线相交(相切的情况也算是相交),有时候不会。 请你来计算一下抛一次硬币之后,该硬币和直线相交数目的期望。Input第一行给出一个整数T,表示有T组数据(1<=T<=10000)。原创 2017-11-21 21:18:34 · 987 阅读 · 0 评论 -
广东工业大学2017新生赛(决赛)-网络同步赛 1007 白色相簿的季节【全错位排列】
白色相簿的季节Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 0 Accepted Submission(s): 0Problem Description又到了白色相簿的季节。狗哥作为广工最帅气的投递员兼代码手,因为最近突然想到没有原创 2017-12-09 17:34:28 · 1305 阅读 · 0 评论