思维好题
凌晨四点的洛杉矶fly
这个作者很懒,什么都没留下…
展开
-
状态压缩
富豪凯匹配串https://ac.nowcoder.com/acm/contest/1114/C简单题意有n个长度为m的文本串,每个串只含有'0'和'1'。接下来有Q次询问,每次给出一个长度为m的字符串,且只含有'0','1'和'_'。如10_1_1。下划线可以匹配'0'或'1'。即10_1_1可以匹配101111,101101,100111,100101四种串。每次询问求出n个文本串中...原创 2019-10-15 10:39:37 · 97 阅读 · 0 评论 -
牛客练习赛53:A(简单dp)
链接:https://ac.nowcoder.com/acm/contest/1114/A来源:牛客网题目描述超越学姐非常喜欢自己的名字,以至于英文字母她只喜欢“c”和“y”。因此超越学姐喜欢只含有“c”和“y”的字符串,且字符串中不能出现两个连续的“c”。请你求出有多少种长度为n的字符串是超越学姐喜欢的字符串。答案对1e9+7取模。输入描述:链接:https://ac.no...原创 2019-10-15 10:06:22 · 125 阅读 · 0 评论 -
子串查询1083/B
链接:https://ac.nowcoder.com/acm/contest/1083/B来源:牛客网题目描述给出一个长度为n的字符串s和q个查询。对于每一个查询,会输入一个字符串t,你需要判断这个字符串t是不是s的子串。子串的定义就是存在任意下标a<b<c<d<e,那么”s[a]s[b]s[c]s[d]s[e]”就构成s的一个子串。如”abc”的子串有”a”...原创 2019-09-17 20:18:17 · 103 阅读 · 0 评论 -
s中子串”abc”的个数
链接:https://ac.nowcoder.com/acm/contest/1083/A来源:牛客网题目描述给出一个字符串s,你需要做的是统计s中子串”abc”的个数。子串的定义就是存在任意下标a<b<c,那么”s[a]s[b]s[c]”就构成s的一个子串。如”abc”的子串有”a”、”b”、”c”、”ab”、”ac”、”bc”、”abc”。输入描述:一个字符...原创 2019-09-10 11:00:22 · 658 阅读 · 0 评论 -
四维dp
链接:https://ac.nowcoder.com/acm/contest/1072/A来源:牛客网题目描述设有N*N的方格图(N ≤ 10,我们将其中的某些方格中填入正整数,而其他的方格中则放入数字0。如下图所示(见样例):某人从图的左上角的A 点出发,可以向下行走,也可以向右走,直到到达右下角的B点。在走过的路上,他可以取走方格中的数(取走后的方格中将变为数字0)。此...原创 2019-09-03 10:44:26 · 372 阅读 · 1 评论 -
并查集 牛客1080/B
链接:https://ac.nowcoder.com/acm/contest/1080/B来源:牛客网题目描述tokitsukaze有n个数,需要按顺序把他们插入哈希表中,哈希表的位置为0到n-1。插入的规则是:刚开始哈希表是空的。对于一个数x,在哈希表中,如果(x mod n)的位置是空的,就把x放在(x mod n)的位置上。如果不是空的,就从(x mod n)往右开始找...原创 2019-09-02 20:43:30 · 112 阅读 · 0 评论 -
牛客1080/A
链接:https://ac.nowcoder.com/acm/contest/1080/A来源:牛客网题目描述tokitsukaze有一个长度为n,只包含小写字母的字符串S。对于每一种字母,若同种字母都连在一起,tokitsukaze会感到心情愉悦。若tokitsukaze会感到心情愉悦,请输出"YES",否则输出"NO"。(均不含引号。)输入描述:第一行输入一个正整数...原创 2019-09-02 19:33:16 · 218 阅读 · 0 评论 -
D - Decrease (Contestant ver.)(思维好题)
Problem StatementWe have a sequence of lengthNconsisting of non-negative integers. Consider performing the following operation on this sequence until the largest element in this sequence becomesN...原创 2019-06-16 22:01:36 · 262 阅读 · 0 评论 -
C - Sequence(思维+贪心)
Problem StatementYou are given an integer sequence of lengthNN. Theii-th term in the sequence isaiai. In one operation, you can select a term and either increment or decrement it by one.At leas...原创 2019-06-05 09:14:16 · 482 阅读 · 0 评论 -
D - Grid Coloring(思维)
题目链接:https://atcoder.jp/contests/arc080/tasks/arc080_bProblem StatementWe have a grid withHHrows andWWcolumns of squares. Snuke is painting these squares in colors11,22,......,NN. Here, th...原创 2019-06-19 18:41:34 · 281 阅读 · 0 评论 -
C - 4-adjacent(思维题)
题目链接:https://atcoder.jp/contests/arc080/tasks/arc080_a题意:给你n个数,问你能不能找到一种排列使相邻两个数的乘积为4的倍数。是输出“Yes”否则输出“No”;思路:两个数的乘积为4的倍数 1是两个数其中有一个为4的倍数;2是两个数都是偶数;代码:#include<bits/stdc++.h>using n...原创 2019-06-19 18:16:57 · 232 阅读 · 0 评论 -
Help Farmer(思维+暴力)
Once upon a time in the Kingdom of Far Far Away lived Sam the Farmer. Sam had a cow named Dawn and he was deeply attached to her. Sam would spend the whole summer stocking hay to feed Dawn in winter. ...原创 2019-06-09 15:32:00 · 252 阅读 · 0 评论 -
poj2018(二分+最大连续子段最大平均值)
DescriptionFarmer John's farm consists of a long row of N (1 <= N <= 100,000)fields. Each field contains a certain number of cows, 1 <= ncows <= 2000.FJ wants to build a fence around a...原创 2019-06-09 11:08:43 · 803 阅读 · 0 评论 -
D - Simple Knapsack(思维+讨论)
Problem StatementYou haveNNitems and a bag of strengthWW. Theii-th item has a weight ofwiwiand a value ofvivi.You will select some of the items and put them in the bag. Here, the total weig...原创 2019-06-05 16:31:18 · 354 阅读 · 0 评论 -
C - Sentou(思维)
https://atcoder.jp/contests/arc073/tasks/arc073_aProblem StatementIn a public bath, there is a shower which emits water forTTseconds when the switch is pushed.If the switch is pushed when the...原创 2019-06-05 15:14:41 · 279 阅读 · 0 评论 -
D - Alice&Brown(博弈,找规律)
Problem StatementAlice and Brown loves games. Today, they will play the following game.In this game, there are two piles initially consisting ofXXandYYstones, respectively. Alice and Bob alter...原创 2019-06-05 14:41:35 · 591 阅读 · 1 评论