自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

旺崽的博客

要么天赋异禀,要么天道酬勤( ఠൠఠ )ノ

  • 博客(80)
  • 资源 (1)
  • 收藏
  • 关注

原创 Educational Codeforces Round 86 (Rated for Div. 2) C.Yet Another Counting Problem

Educational Codeforces Round 86 (Rated for Div. 2) C.Yet Another Counting Problem题目链接You are given two integers a and b, and q queries. The i-th query consists of two numbers li and ri, and the answ...

2020-04-29 10:07:13 2297

原创 Educational Codeforces Round 86 (Rated for Div. 2) B.Binary Period

Educational Codeforces Round 86 (Rated for Div. 2) B.Binary Period题目链接Let’s say string s has period k if si=si+k for all i from 1 to |s|−k (|s| means length of string s) and k is the minimum positiv...

2020-04-28 15:16:57 2463

原创 AtCoder Beginner Contest 164 D.Multiple of 2019

AtCoder Beginner Contest 164 D.Multiple of 2019这题感觉有印象,就是从后往前 dpdpdp,有重复的加上重复的即可,AC代码如下:#include<bits/stdc++.h>using namespace std;typedef long long ll;int main(){ string s; cin&g...

2020-04-27 09:45:21 2675

原创 LightOJ 1245 Harmonic Number (II)

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 = re...

2020-04-26 16:50:58 2262

原创 POJ 2774 Long Long Message

POJ 2774 Long Long Message题目链接DescriptionThe little cat is majoring in physics in the capital of Byterland. A piece of sad news comes to him these days: his mother is getting ill. Being worried abo...

2020-04-25 17:22:08 2383

原创 Panasonic Programming Contest 2020 E.Three Substrings

Panasonic Programming Contest 2020 E.Three Substrings题目链接这题考虑到贪心会有疏漏,加上数据范围比较小,所以考虑穷搜,即记录下所有冲突位置,ababab 数组记录字符串 aaa 和 bbb 中不同的元素的位置,acacac 数组和 bcbcbc 数组同理下面考虑将字符串 bbb 和 ccc 这两个字符串插入到 aaa 的两侧,则最大范围...

2020-04-25 15:58:14 2331

原创 AtCoder Beginner Contest 160 F.Distributing Integers

AtCoder Beginner Contest 160 F.Distributing Integers题目链接这题就是树上 dfsdfsdfs 了,对每个结点 vvv,可以递归得到答案,假设与之相连的结点有 nnn 个,总数即为 n!n!n!,那么可以递归求出不满足条件的情况 f[v]f[v]f[v],那么答案即为 n!f[v]\frac{n!}{f[v]}f[v]n!​,AC代码如下:...

2020-04-25 11:33:00 2431

原创 Codeforces Round #609 (Div. 1) B.Domino for Young

Codeforces Round #609 (Div. 1) B.Domino for Young题目链接You are given a Young diagram.Given diagram is a histogram with n columns of lengths a1,a2,…,an (a1≥a2≥…≥an≥1).Young diagram for a=[3,2,2,2,1]...

2020-04-24 17:08:39 2524

原创 POJ 2262 Goldbach's Conjecture

POJ 2262 Goldbach’s Conjecture题目链接DescriptionIn 1742, Christian Goldbach, a German amateur mathematician, sent a letter to Leonhard Euler in which he made the following conjecture:Every even numbe...

2020-04-24 15:25:58 2339

原创 LightOJ 1259 Goldbach`s Conjecture

LightOJ 1259 Goldbach`s ConjectureGoldbach’s conjecture is one of the oldest unsolved problems in number theory and in all of mathematics. It states:Every even integer, greater than 2, can be expres...

2020-04-24 15:16:31 2361

原创 LightOJ 1282 Leading and Trailing

LightOJ 1282 Leading and Trailing题目链接You are given two integers: n and k, your task is to find the most significant three digits, and least significant three digits of nkn^knk.InputInput starts wi...

2020-04-24 11:51:34 2201

原创 Codeforces Round #637 (Div. 2) - Thanks, Ivan Belonogov! C. Nastya and Strange Generator

Codeforces Round #637 (Div. 2) - Thanks, Ivan Belonogov! C. Nastya and Strange GeneratorBeing upset after this behavior of Nastya, Denis was very sad. Nothing could make the rejected guy happier. To ...

2020-04-24 08:43:49 3081 4

原创 Codeforces Round #637 (Div. 2) - Thanks, Ivan Belonogov! B.Nastya and Door

Codeforces Round #637 (Div. 2) - Thanks, Ivan Belonogov! B.Nastya and Door题目链接On February 14, Denis decided to give a Valentine to Nastya and did not come up with anything better than to draw a huge...

2020-04-24 08:23:01 3547 9

原创 HDUOJ 4687 Boke and Tsukkomi

HDUOJ 4687 Boke and Tsukkomi题目链接Problem DescriptionA new season of Touhou M-1 Grand Prix is approaching. Girls in Gensokyo cannot wait for participating it. Before the registration, they have to de...

2020-04-23 17:06:18 2244

原创 URAL 1099 Work Scheduling

URAL 1099 Work Scheduling题目链接There is a certain amount of night guards that are available to protect the local junkyard from possible junk robberies. These guards need to be scheduled in pairs so th...

2020-04-23 16:03:41 2312

原创 HDUOJ 3488 Tour

HDUOJ 3488 Tour题目链接Problem DescriptionIn the kingdom of Henryy, there are N (2 <= N <= 200) cities, with M (M <= 30000) one-way roads connecting them. You are lucky enough to have a chance...

2020-04-22 14:41:00 2293

原创 Codeforces Round #636 (Div. 3) D.Constant Palindrome Sum

Codeforces Round #636 (Div. 3) D.Constant Palindrome Sum题目链接You are given an array a consisting of n integers (it is guaranteed that n is even, i.e. divisible by 2). All ai does not exceed some inte...

2020-04-22 14:20:37 2405

原创 Codeforces Round #636 (Div. 3) C.Alternating Subsequence

Codeforces Round #636 (Div. 3) C.Alternating Subsequence题目链接Recall that the sequence b is a a subsequence of the sequence a if b can be derived from a by removing zero or more elements without chang...

2020-04-22 09:59:02 2442

原创 HDUOJ 2255 奔小康赚大钱

HDUOJ 2255 奔小康赚大钱题目链接Problem Description传说在遥远的地方有一个非常富裕的村落,有一天,村长决定进行制度改革:重新分配房子。这可是一件大事,关系到人民的住房问题啊。村里共有n间房间,刚好有n家老百姓,考虑到每家都要有房住(如果有老百姓没房子住的话,容易引起不安定因素),每家必须分配到一间房子且只能得到一间房子。另一方面,村长和另外的村领导希望得到最大...

2020-04-21 18:24:31 2135

原创 POJ 3189 Steady Cow Assignment

POJ 3189 Steady Cow Assignment题目链接DescriptionFarmer John’s N (1 <= N <= 1000) cows each reside in one of B (1 <= B <= 20) barns which, of course, have limited capacity. Some cows really...

2020-04-21 16:15:36 2282

原创 POJ 2112 Optimal Milking

POJ 2112 Optimal Milking题目链接DescriptionFJ has moved his K (1 <= K <= 30) milking machines out into the cow pastures among the C (1 <= C <= 200) cows. A set of paths of various lengths r...

2020-04-21 15:32:33 2305

原创 POJ 2289 Jamie's Contact Groups

POJ 2289 Jamie’s Contact Groups题目链接DescriptionJamie is a very popular girl and has quite a lot of friends, so she always keeps a very long contact list in her cell phone. The contact list has becom...

2020-04-21 10:02:42 2472

原创 HDUOJ 3829 Cat VS Dog

HDUOJ 3829 Cat VS Dog题目链接Problem DescriptionThe zoo have N cats and M dogs, today there are P children visiting the zoo, each child has a like-animal and a dislike-animal, if the child’s like-anima...

2020-04-20 20:15:03 2187

原创 POJ 2594 Treasure Exploration

POJ 2594 Treasure Exploration题目链接DescriptionHave you ever read any book about treasure exploration? Have you ever see any film about treasure exploration? Have you ever explored treasure? If you ne...

2020-04-20 17:31:30 2255

原创 HDUOJ 1151 Air Raid

HDUOJ 1151 Air Raid题目链接Problem DescriptionConsider a town where all the streets are one-way and each street leads from one intersection to another. It is also known that starting from an intersecti...

2020-04-20 17:08:38 2231

原创 AtCoder Beginner Contest 163 F.path pass i

AtCoder Beginner Contest 163 F.path pass i题目链接一道比较有意思的树的问题,题意很简单就不赘述了~首先我们知道对一棵节点为 nnn 的树,总路径数 sumsumsum 一定为 n∗(n+1)/2n*(n+1)/2n∗(n+1)/2 ,可以自己画图验证,这是离散数学的基本知识~如果对每个点都遍历一遍显然不现实,所以我们就以 1 为根节点进行 DFS...

2020-04-20 16:40:15 2632 4

原创 AtCoder Beginner Contest 163 E.Active Infants

AtCoder Beginner Contest 163 E.Active Infants题目链接这题我本来用暴力,发现有点问题,也一直没调出来,看了题解发现可以用 DFSDFSDFS 加动态规划,用 dp[i][j]dp[i][j]dp[i][j] 表示 iii 到 jjj 范围内调整位置后的最大值,逐层递归即可,AC代码如下:#include<bits/stdc++.h>...

2020-04-20 12:12:11 2351

原创 AtCoder Beginner Contest 163 D.Sum of Large Numbers

AtCoder Beginner Contest 163 D.Sum of Large Numbers题目链接简单的找规律题我们取 kkk 个数时,不难发现,最小的取值就是 kkk 个数的最小取值 minminmin,最大的取值就是 kkk 个数的最大取值 maxmaxmax,而取值个数就是 max−min+1max-min+1max−min+1,遍历一遍更新答案即可,AC代码如下:#i...

2020-04-20 10:33:12 2425

原创 牛客小白月赛24 C.十面埋伏

牛客小白月赛24 C.十面埋伏题目链接题目描述经过多年的征战,牛牛在与牛可乐的对决渐渐处于下风,于是牛牛决定对牛可乐来一次大围剿。战场可以看作一张 n*m 的地图,牛可乐的士兵只能上下左右移动,不能斜着移动,牛牛决定挖一圈陷阱包围牛可乐的士兵。牛牛想知道包围牛可乐的士兵所需要的最少的陷阱数量是多少(划掉,具体请看update),但是牛牛并不会排兵布阵,于是只能求助于你了。保证地图的边界处...

2020-04-19 17:10:33 2300

原创 POJ 3436 ACM Computer Factory

POJ 3436 ACM Computer Factory题目链接DescriptionAs you know, all the computers used for ACM contests must be identical, so the participants compete on equal terms. That is why all these computers are h...

2020-04-19 16:15:00 2221

原创 牛客小白月赛24 D.牛妹吃豆子

牛客小白月赛24 D.牛妹吃豆子题目链接题目描述牛妹为了打比赛经常不吃饭,但是牛妹非常喜欢吃豆子,她经常会吃很多很多的豆子,所以牛妹不会感觉到饿, 自然就不想吃饭了。现在牛妹有一个 n∗m 个格子的棋盘.左下角的格子坐标为 (1, 1), 右上角的格子坐标为 (n,m).棋盘的每个格子都能放任意个豆子.这时牛可乐带着一袋豆子走了过来, 打算跟牛妹分享这些豆子, 但是牛可乐并不想就这么简单...

2020-04-19 11:52:17 2519

原创 牛客小白月赛24 J.建设道路

牛客小白月赛24 J.建设道路题目链接题目描述牛牛国有 nnn 个城市,编号为 1-n,第 iii 个城市有一个价值 aia_iai​ ,牛国的国王牛阔落特别喜欢在牛牛国旅游,并且他不想每次旅游的时候都计算一遍走哪条路最短,于是他决定在任意两个城市之间建立一条双向道路,在第 iii 座城市和第 jjj 座城市之间建立双向道路的代价是 (ai−aj)2(a_i-a_j)^2(ai​−aj​)2...

2020-04-19 10:15:23 2446

原创 牛客小白月赛24 H.人人都是好朋友

牛客小白月赛24 H.人人都是好朋友题目链接题目描述牛可乐作为三军统帅,是要时时刻刻关照着下属的。现在牛可乐想要知道自己的手下之间的友好关系,所以他收集了 nn 张纸条,上面写着三个整数 ai,bi,cia_i,b_i,c_iai​,bi​,ci​ ,表示如果 cic_ici​ 为 1,表示手下 aia_iai​ 和手下 bib_ibi​ 是朋友,反之则是敌人。牛可乐想要知道这些信息...

2020-04-19 09:58:43 2242

原创 牛客小白月赛24 I.求和

牛客小白月赛24 I.求和题目链接题目描述已知有 nnn 个节点,有 n−1n-1n−1 条边,形成一个树的结构。给定一个根节点 kkk,每个节点都有一个权值,节点i的权值为 viv_ivi​ 。给 mmm 个操作,操作有两种类型:1 a x :表示将节点 aaa 的权值加上 xxx2 a :表示求 aaa 节点的子树上所有节点的和(包括 aaa 节点本身)输入描述:...

2020-04-19 09:45:58 2357

原创 P3376 【模板】网络最大流

P3376 【模板】网络最大流题目链接题目描述如题,给出一个网络图,以及其源点和汇点,求出其网络最大流。输入格式第一行包含四个正整数 n,m,s,t,分别表示点的个数、有向边的个数、源点序号、汇点序号。接下来M行每行包含三个正整数 ui,vi,wiu_i,v_i,w_iui​,vi​,wi​ ,表示第 iii 条有向边从 uiu_iui​ 出发,到达 viv_ivi​ ,边权为 wi...

2020-04-18 14:25:54 2252

原创 牛客挑战赛39 A.聚会

牛客挑战赛39 A.聚会题目链接题目描述牛牛过生日啦!他决定在家里举办一场生日聚会。通往牛牛家里的道路正好是一条无限长的道路,为了简单起见,我们把它想象成一条直线——关于 xxx 的数轴。其中牛牛的家位于 x=0x=0x=0 原点,想邀请 nnn 位朋友参加本次生日聚会,其中第 iii 位朋友家居住在 xix_ixi​​ 的位置,初始他们同时以 1 单位每秒的速度从家里出发前往聚会的地点。...

2020-04-18 10:51:29 2305

原创 POJ 1273 Drainage Ditches

POJ 1273 Drainage Ditches题目链接DescriptionEvery time it rains on Farmer John’s fields, a pond forms over Bessie’s favorite clover patch. This means that the clover is covered by water for awhile and ...

2020-04-17 16:42:30 2227

原创 AtCoder Beginner Contest 161 F.Division or Subtraction

AtCoder Beginner Contest 161 F.Division or Subtraction题目链接Problem StatementGiven is a positive integer N.We will choose an integer K between 2 and N (inclusive), then we will repeat the operation ...

2020-04-17 15:05:24 2438

原创 AtCoder Beginner Contest 162 F.Select Half

AtCoder Beginner Contest 162 F.Select Half题目链接题意非常简单,很明显的dp我们考虑如何动态规划得到最优解:用 dp[i]dp[i]dp[i] 表示选到当前位置的最优解题目要求不能取相邻的元素,那么我们可以优先预处理不相邻元素的前缀和 sum[i]sum[i]sum[i]下面考虑状态转移方程,因为是隔位dp,肯定是要考虑奇偶性的:对奇数位...

2020-04-17 11:03:17 2417

原创 针对运行JSP文件后网页自动下载的解决办法

我写完某个JSP文件后用服务器调用惊奇地发现一加载网址就自动下载~其实问题主要出现在 pagepagepage 指令标记上,下面这个是正确格式<%@ page contentType="text/html;charset=UTF-8" %>一般有两个错误:1 text 写成 txt错误:<%@ page contentType="txt/html;charset=U...

2020-04-16 19:43:18 4822

ACM模板库.docx

适合于ACM入门小白选手

2021-11-06

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除