![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
思维
qq_37383726
这个作者很懒,什么都没留下…
展开
-
【牛客练习赛59】 A【DP】B【思维】C【三分】D【记忆化搜索】
文章目录ABCDA思路:很经典的题目了,不仅可以判定是否有这样的子序列,同时还可以找到有多少这样的子序列。Code:#include <bits/stdc++.h>using namespace std;typedef long long ll;typedef pair<int, int> pii;const int N = 1e5 + 11;cons...原创 2020-03-22 12:23:46 · 190 阅读 · 0 评论 -
【HPU 1192】: Sequence 【 状态压缩】
题目描述 在某个夜黑月高的晚上,!!!,原谅我编不下去了。 (http://acm.hpu.edu.cn/upload/image/20161125/20161125214540_41845.jpg) 很美吧?放松之后,继续做题吧。HS(Handsome)的Ocean在纸上写下NN个整数,Ocean把它定义为OO序列。Ocean认为一个序列的价值的是:序列中不同元素个数。现在他想知道OO序列原创 2017-10-21 00:11:32 · 261 阅读 · 0 评论 -
【HDU- 4648】 Magic Pen 6 【思维 】
In HIT, many people have a magic pen. Lilu0355 has a magic pen, darkgt has a magic pen, discover has a magic pen. Recently, Timer also got a magic pen from seniors. At the end of this term, teacher giv原创 2017-11-13 17:01:27 · 286 阅读 · 0 评论 -
【Gym - 101350G】Snake Rana 【状态压缩 +容斥定理】
Old Macdonald wants to build a new hen house for his hens. He buys a new rectangular area of size N by M. The night before he builds the hen house, snake Rana devises an evil plan to plant bombs in K d原创 2017-11-03 23:01:25 · 272 阅读 · 0 评论 -
【CodeForces - 894】 A【暴力】B【思维+欧拉降幂】C【构造+思维】
A - QAQ “QAQ” is a word to denote an expression of crying. Imagine “Q” as eyes with tears and “A” as a mouth.Now Diamond has given Bort a string consisting of only uppercase English letters of length原创 2017-11-21 22:49:31 · 508 阅读 · 0 评论 -
【Wannafly挑战赛5】 A 【思维枚举】B C【排列组合 公式】
A 珂朵莉与宇宙 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 65536K,其他语言131072K 64bit IO Format: %lld 题目描述 星神是来自宇宙的 所以珂朵莉也是吧 所以我就出了个题 给你一个长为n的序列a,有n*(n+1)/2个子区间,问这些子区间里面和为完全平方数的子区间个数 输入描述: 第一行一个数n 第二行n个数表示序列a原创 2017-12-09 19:37:09 · 582 阅读 · 0 评论 -
【2017年浙江中医药大学大学生程序设计竞赛】F 开心的cc 【线段树+思维】
时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld 题目描述 CC is a smart girl and she is curious about everything. One day she starts to analyze her lifestyle and finds out that原创 2017-12-21 20:02:31 · 560 阅读 · 0 评论 -
【2017年浙江中医药大学大学生程序设计竞赛】B一生之敌 【二分+精度】
B 一生之敌 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld 题目描述 大家都知道Alice和Bob两个人是一生之敌。(雾 但某天,他们两个人发了疯。想知道他们两个是否可以成为朋友。 于是他们做了一个令人窒息的决定。 Alice和Bob每个人任意选一个整数。 假设A原创 2017-12-21 19:47:26 · 308 阅读 · 0 评论 -
【哈尔滨理工大学第七届程序设计竞赛决赛(高年级组)】E 求最大值 【线段树+思维】
时间限制:C/C++ 3秒,其他语言6秒 空间限制:C/C++ 32768K,其他语言65536K 64bit IO Format: %lld 题目描述 给出一个序列,你的任务是求每次操作之后序列中 (a[j]-a[i])/(j-i)【1< = i < j < = n】的最大值。 操作次数有Q次,每次操作需要将位子p处的数字变成y. 输入描述: 本题包含多组输入,每组输入第一行一个原创 2017-12-21 21:13:03 · 301 阅读 · 0 评论 -
【第五届“图灵杯”NEUQ-ACM程序设计大赛】A C D【哈夫曼树】E【手写链表】 F G H【圆周排列生成】 I
A 逃出生天 题目描述: gold学长从昏迷中醒来以后发现自己被困在一个山洞里,他找了很久,终于找到一个门。门上写着:想要逃出去,只有一个办法 你可以选择一个数n,设m=1 * 2 * … * (n-1)。如果m是n的倍数,那么门就会自动打开,否则你就别想出去了。 gold学长内心充满了绝望,他想了一些数,但他不知道这些数能不能保证自己逃出去。你能帮助gold学长逃出生天吗? 输入: 第一原创 2017-12-04 15:40:40 · 1072 阅读 · 0 评论 -
【POJ - 3422】Kaka's Matrix Travels 【拆点费用流+经典建图】
On an N × N chessboard with a non-negative number in each grid, Kaka starts his matrix travels with SUM = 0. For each travel, Kaka moves one rook from the left-upper grid to the right-bottom one, takin原创 2017-10-26 17:35:32 · 243 阅读 · 0 评论 -
【CodeForces - 849】A【思维】 B【暴力】C【思维+构造】
A Odds and Ends Where do odds begin, and where do they end? Where does hope emerge, and will they ever break?Given an integer sequence a1, a2, …, an of length n. Decide whether it is possible to divi原创 2017-10-23 23:39:57 · 336 阅读 · 0 评论 -
【Codeforces Round #427】 C 【打表+DP】
The Cartesian coordinate system is set in the sky. There you can see n stars, the i-th has coordinates (xi, yi), a maximum brightness c, equal for all stars, and an initial brightness si (0 ≤ si ≤ c).O原创 2017-10-13 18:01:46 · 261 阅读 · 0 评论 -
【CF #435】C 【思维+异或的特点】
C. Mahmoud and Ehab and the xor time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Mahmoud and Ehab are on the third stage of their ad原创 2017-10-13 18:05:29 · 266 阅读 · 0 评论 -
【CF #435】A B C
A. Mahmoud and Ehab and the MEX time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Dr. Evil kidnapped Mahmoud and Ehab in the evil land bec原创 2017-10-12 22:49:03 · 199 阅读 · 0 评论 -
【HDU - 5927】 Auxiliary Set 【DFS +思维】
Mr. Frog learned a basic data structure recently, which is called stack.There are some basic operations of stack: ∙∙ PUSH x: put x on the top of the stack, x must be 0 or 1. ∙∙ POP: throw the element原创 2017-11-08 18:30:28 · 284 阅读 · 0 评论 -
【CodeForces - 849】C From Y to Y 【思维+构造+贪心】
From beginning till end, this message has been waiting to be conveyed.For a given unordered multiset of n lowercase English letters (“multi” means that a letter may appear more than once), we treat all原创 2017-10-24 13:24:14 · 364 阅读 · 0 评论 -
【CodeForces 686 D. 】 【树的重心性质】
D. Kay and Snowflake time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output After the piece of a devilish mirror hit the Kay’s eye, he is no原创 2017-10-15 21:26:51 · 587 阅读 · 0 评论 -
【CodeForces - 638】C 【思维+DFS】
In Berland there are n cities and n - 1 bidirectional roads. Each road connects some pair of cities, from any city you can get to any other one using only the given roads.In each city there is exactly原创 2017-10-15 01:00:21 · 357 阅读 · 0 评论 -
【 CodeFors 877 】 A B
A Div. 64 Top-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills.Her problem is following: for given string, consisting of only 0 and 1, tell原创 2017-11-09 21:30:32 · 369 阅读 · 0 评论 -
【CodeForces - 834】 A【模拟】 B【模拟】C【思维】
A The Useless Toy Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join原创 2017-10-24 22:43:30 · 447 阅读 · 0 评论 -
【第八届河南理工大学程序设计大赛(正式赛)】 BDE F GHIJKLM
问题 F: GCD与LCM 题目描述 Ocean某天遇到了一个很简单的数学题,但是他的大脑已经超负荷了。现在请你帮帮他吧:已知D = GCD(x, y) + LCM(x, y),求合法组合(x, y)总数,其中x > 0且y > 0。输入 第一行输入一个整数T,代表有T组测试数据。接下来每行输入一个整数D。注:1<=T,D<=1051<=T,D<=105。输出 对每组测试数据,输出一个整数代原创 2017-12-11 21:28:20 · 1267 阅读 · 0 评论 -
【2017年浙江工业大学大学生程序设计迎新赛决赛】 A 小杰接网线【思维+组合数学】
时间限制:C/C++ 5秒,其他语言10秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld 题目描述 小杰是学院中公认的计算机大神,有一天小杰受邀去机房帮忙接网线,他三下五除二地就帮忙完成了。可是善于思考地他仍意有未尽,他觉得这次的线路有许多奇妙的性质,故来请教你。 机房有n台不同的主机(编号为0,1原创 2017-12-27 00:05:05 · 391 阅读 · 0 评论 -
【2017年浙江工业大学大学生程序设计迎新赛决赛】D 序列 【离散化+分块+莫队】
时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld 题目描述 读入一个长度为n的整数数列a1,a2,…,an,以及一个整数K。 q组询问。 每组询问包含一个二元组(l, r), 其中1≤l≤r≤ n, 求所有满足以下条件的二元组(l2, r2)的数目: 1: 1≤l≤l2≤r2≤r≤n,原创 2017-12-28 14:49:14 · 277 阅读 · 0 评论 -
【牛客练习赛13】 A B C D【康拓展开】 E【DP or 记忆化搜索】 F 【思维】
A 幸运数字Ⅰ链接:https://www.nowcoder.com/acm/contest/70/A 来源:牛客网时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述 定义一个数字为幸运数字当且仅当它的所有数位都是4或者7。 比如说,47、744、4都是幸运数字而5...原创 2018-03-17 11:09:13 · 5103 阅读 · 0 评论 -
【Wannafly交流赛1】 A B【思维】 D【平面图最小割转最短路】
A-有理数链接:https://www.nowcoder.com/acm/contest/69/A 来源:牛客网时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述 有一个问题如下: 给你一个有理数v,请找到小于v的最大有理数。 但这个问题的答案对于任意v都是无解的! ...原创 2018-03-04 10:13:58 · 265 阅读 · 0 评论 -
【CodeForces 689C】Mike and Chocolate Thieves 【二分+ 思维 】
Bad news came to Mike’s village, some thieves stole a bunch of chocolates from the local factory! Horrible!Aside from loving sweet things, thieves from this area are known to be very greedy. So afte...原创 2018-03-12 20:49:32 · 177 阅读 · 0 评论 -
【LightOJ - 1245】 Harmonic Number (II) 【数论 - 常见的减少时间复杂度的思想】
I was trying to solve problem ‘1234 - Harmonic Number’, I wrote the following codelong long H( int n ) { long long res = 0; for( int i = 1; i <= n; i++ ) res = res + n / i; ...原创 2018-04-03 16:27:58 · 208 阅读 · 0 评论 -
【LightOJ 1236】 Pairs Forming LCM 【算术基本定理+排列组合】
long long pairsFormLCM( int n ) { long long res = 0; for( int i = 1; i <= n; i++ ) for( int j = i; j <= n; j++ ) if( lcm(i, j) == n ) res++; // lcm means least common ...原创 2018-04-12 16:22:27 · 147 阅读 · 0 评论 -
【LightOJ - 1220 】Mysterious Bacteria 【算数基本定理+思维】
Dr. Mob has just discovered a Deathly Bacteria. He named it RC-01. RC-01 has a very strange reproduction system. RC-01 lives exactly x days. Now RC-01 produces exactly p new deadly Bacteria where x = ...原创 2018-04-12 16:52:20 · 464 阅读 · 0 评论 -
【牛客网】 Fibonacci进制 【】
链接:https://www.nowcoder.com/acm/contest/105/D 来源:牛客网时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536K 64bit IO Format: %lld 题目描述 Fibonacci数是非常有名的一个数列,它的公式为 f(n)=f(n-1)+f(n-2),f(0)=1,f(1)=2。 ...原创 2018-05-05 11:08:51 · 336 阅读 · 0 评论 -
【 P2661】 信息传递 【Tarjan or 并查集 】
题目描述 有 nn 个同学(编号为 11 到 nn )正在玩一个信息传递的游戏。在游戏里每人都有一个固定的信息传递对象,其中,编号为 ii 的同学的信息传递对象是编号为 T_iT i 的同学。游戏开始时,每人都只知道自己的生日。之后每一轮中,所有人会同时将自己当前所知的生日信息告诉各自的信息传递对象(注意:可能有人可以从若干人那里获取信息, 但是每人只会把信息告诉一个人,即...原创 2018-06-07 18:48:57 · 363 阅读 · 0 评论 -
【CodeFores 948 】B【筛法+思维】C【树状数组+思维】
B. Primal Sport time limit per test1.5 seconds memory limit per test256 megabytes inputstandard input outputstandard output Alice and Bob begin their day with a quick game. They first choose a st...原创 2018-03-15 18:26:53 · 161 阅读 · 0 评论 -
【POJ - 3276 】 Face The Right Way 【区间加减+单点查询+翻转特性】
Farmer John has arranged his N (1 ≤ N ≤ 5,000) cows in a row and many of them are facing forward, like good cows. Some of them are facing backward, though, and he needs them all to face forward to mak...原创 2018-02-21 13:42:51 · 162 阅读 · 0 评论 -
【CodeForces - 919E】 Congruence Equation 【费马小定理 + 思维】
Given an integer x. Your task is to find out how many positive integers n (1 ≤ n ≤ x) satisfywhere a, b, p are all known constants. Input The only line contains four integers a, b, p, x (2 ≤ p ≤原创 2018-02-05 23:12:37 · 308 阅读 · 0 评论 -
【2017年浙江工业大学大学生程序设计迎新赛决赛】E 栗酱的数列【思维转化+KMP】
时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld 题目描述 栗酱有一个长度为n的数列A,一个长度为m的数列B,现在询问A中有多少个长度为m的连续子序列A’, 满足(a’1+b1)%k = (a’2+b2)%k = …… = (a’m + bm)%k。 输入描述: 第一行一个数T,表示有T组原创 2017-12-25 23:32:35 · 301 阅读 · 0 评论 -
【Wannafly挑战赛1 】B Xorto 【思维+二分】
时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 32768K,其他语言65536K 64bit IO Format: %lld 题目描述 给定一个长度为n的整数数组,问有多少对互不重叠的非空区间,使得两个区间内的数的异或和为0。 输入描述: 第一行一个数n表示数组长度; 第二行n个整数表示数组; 1<=n<=1000,0<=数组元素<100000。 输出描述: 一原创 2017-12-08 07:33:26 · 291 阅读 · 0 评论 -
【Wannafly挑战赛6】 A B C E
A 完全平方数 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld 题目描述 多次查询[l,r]范围内的完全平方数个数 定义整数x为完全平方数当且仅当可以找到整数y使得y*y=x 输入描述: 第一行一个数n表示查询次数 之后n行每行两个数l,r 输出描述: 对于每个查询,输出一个数表原创 2017-12-24 21:58:23 · 387 阅读 · 0 评论 -
【牛客练习赛9】F 珂朵莉的约数 【数论+莫队】
时间限制:C/C++ 3秒,其他语言6秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述 珂朵莉给你一个长为n的序列,有m次查询 每次查询给两个数l,r 设s为区间[l,r]内所有数的乘积 求s的约数个数mod 1000000007 输入描述: 第一行两个正整数n,m 第二行一个长为n的序列 之后m行每行两个数原创 2017-12-30 13:43:27 · 325 阅读 · 2 评论 -
【牛客练习赛11】 B 假的字符串【字典树+topo判环】
链接:https://www.nowcoder.com/acm/contest/59/B 来源:牛客网时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536K 64bit IO Format: %lld 题目描述 给定n个字符串,互不相等,你可以任意指定字符之间的大小关系(即重定义字典序),求有多少个串可能成为字典序最小的串,并输出它们原创 2018-01-28 13:39:17 · 663 阅读 · 0 评论