自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

BenFromHRBUST的CSDN博客

BenFromHRBUST的CSDN博客

  • 博客(50)
  • 收藏
  • 关注

原创 Codeforces DeltixRoundSpring2021(Div.1+Div.2) 1523

Codeforces Deltix Round, Spring 2021 (open for everyone, rated, Div. 1 + Div. 2)传送门A. Game of Life思路这题代码写的比较丑。主要思路就是判断两个1之间如何填充,暴力输出即可。Code#include <bits/stdc++.h>using namespace std;typedef long long ll;typedef unsigned long long ull;ty

2021-06-01 02:17:36 401

原创 Codeforces Round #686 (Div. 3) 1454E Number of Simple Paths

Codeforces Round #686 (Div. 3) 1454E Number of Simple PathsProblem DescriptionYou are given an undirected graph consisting of n vertices and n edges. It is guaranteed that the given graph is connected (i. e. it is possible to reach any vertex from any ot

2020-11-25 15:59:30 235

原创 Codeforces Round #612 (Div. 1) - BenFromHRBUST

Codeforces Round #612 (Div. 1)比赛传送门A - GarlandProblem DescriptionVadim loves decorating the Christmas tree, so he got a beautiful garland as a present. It consists of n light bulbs in a single row. Each bulb has a number from 1 to n (in arbitrary order

2020-09-28 23:05:08 160

原创 Codeforces Round #671 (Div. 2) - BenFromHRBUST

Codeforces Round #671 (Div. 2)比赛传送门A - Digit GameCodedef main(): t = eval(input()) for cas in range(t): n = eval(input()) s = input() lens = len(s) odd, even = 0, 0 for i in range(lens): tmp =

2020-09-23 00:07:27 169

原创 Codeforces Round #667 (Div. 3) - BenFromHRBUST

Codeforces Round #667 (Div. 3)比赛传送门A - Yet Another Two Integers ProblemCodedef main(): T = eval(input()) for cas in range(T): a, b = map(int, input().split()) print("{}".format((abs(a-b)+9)//10)) main()B - Minimum Product

2020-09-06 23:09:45 177

原创 HDU 2020 Multi-University Training Contest 8 杭电2019多校联合训练赛 第八场 1006 The Oculus (6768)

Problem DescriptionLet’s define the Fibonacci sequence F1,F2,… as F1=1,F2=2,Fi=Fi−1+Fi−2 (i≥3).It’s well known that every positive integer x has its unique Fibonacci representation (b1,b2,…,bn) such that:· b1×F1+b2×F2+⋯+bn×Fn=x.· bn=1, and for each i (

2020-07-23 23:27:20 248

原创 Codeforces Round #595 (Div. 3) - BenFromHRBUST

Codeforces Round #595 (Div. 3)比赛传送门A - Yet Another Dividing into TeamsCode#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,a,b) for(int i=(a);i<=(b)...

2020-02-10 22:45:33 135

原创 Codeforces Round #618 (Div. 2) - BenFromHRBUST

A. Non-zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputProblem DescriptionGuy-Manuel and Thomas have an array a of n integers [a1,a2,…,an...

2020-02-10 22:21:21 892

原创 2020牛客寒假算法基础集训营2 H 施魔法 - BenFromHRBUST

2020牛客寒假算法基础集训营2H 施魔法题意如题。思路动态规划。f [ ]为DP数组,DP方程如下:坑点没想到可以一维解。。。Code#include <bits/stdc++.h>#include <cstdio>#include <algorithm>#include <cstring>#include &lt...

2020-02-06 20:01:51 322

原创 2020牛客寒假算法基础集训营1 J u's的影响力

2020牛客寒假算法基础集训营1J u’s的影响力题意如题。思路我们可以发现,x和y的幂次是斐波那契数列的某一项,ab的幂次的递推公式为F[i] = F[i-1] + F[i-2] +1。所以我们可以用矩阵快速幂跑出幂次。但是由于幂次过大,无法直接求解,所以我们需要再套一个欧拉降幂,也就是幂次的递推时的模数为MOD-1。坑点要注意幂次模完之后可能会是0。啊啊啊啊啊!卡了我一晚上...

2020-02-05 02:16:55 1651

原创 寒假训练20200130(补题)

C - Unusual Product CodeForces - 405CProblem DescriptionLittle Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.The dot prod...

2020-02-01 00:53:41 259

原创 寒假训练20200126(补题)

B - Berstagram CodeForces - 1250AProblem DescriptionPolycarp recently signed up to a new social network Berstagram. He immediately published n posts there. He assigned numbers from 1 to n to all pos...

2020-01-27 01:12:40 266

原创 寒假训练20200116

B Codeforces 1267EProblem DescriptionByteburg Senate elections are coming. Usually “United Byteland”, the ruling Byteland party, takes all the seats in the Senate to ensure stability and sustainable...

2020-01-17 00:23:15 740

原创 Codeforces Round #611 (Div. 3) - BenFromHRBUST

A Minutes Before the New YearProblem DescriptionNew Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows h hours and m minu...

2020-01-15 23:19:09 786

原创 寒假训练20200114(补题)

A CodeForces 1255C League of LeesinsProblem DescriptionBob is an avid fan of the video game “League of Leesins”, and today he celebrates as the League of Leesins World Championship comes to an end!...

2020-01-15 22:36:55 476

原创 Codeforces Round #598 (Div. 3) - BenFromHRBUST

Codeforces Round #598 (Div. 3)比赛传送门A - Payment Without ChangeProblem DescriptionYou have a coins of value n and b coins of value 1. You always pay in exact change, so you want to know if there exi...

2019-11-06 00:37:11 439

原创 Codeforces Round #597 (Div. 2) - BenFromHRBUST

Codeforces Round #597 (Div. 2)-----比赛传送门-----A - Good ol’ Numbers ColoringProblem DescriptionConsider the set of all nonnegative integers: 0,1,2,…. Given two integers a and b (1≤a,b≤104). We paint...

2019-11-04 00:51:21 485

原创 大菜鸡的图论之旅-[kuangbin带你飞]专题一 简单搜索

大菜鸡的图论之旅-[kuangbin带你飞]专题一 简单搜索拖了一万年,可算把这个专题做完了。再拖拖拉拉我是狗。A POJ 1321 棋盘问题Problem Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。In...

2019-10-31 12:24:03 447

原创 Codeforces Round #553 (Div. 2) 1151D Stas and the Queue at the Buffet

Codeforces Round #553 (Div. 2) 1151D Stas and the Queue at the Buffet水题翻车留念(于2019/10/08的练习)Problem DescriptionDuring a break in the buffet of the scientific lyceum of the Kingdom of Kremland, the...

2019-10-09 00:14:17 193

原创 The 2019 Asia Nanchang First Round Online Programming Contest (H The Nth Item) - BenFromHRBUST

The 2019 Asia Nanchang First Round Online Programming Contest (H The Nth Item)题意给定一个递归式,给定一个数字n和q次操作,每次操作将上一次的答案ans和上一次的n,(ans*ans)^n作为这次的n,并将每次的ans异或起来作为最终答案输出。思路根据广义斐波那契数列,我们可以得到此递归式的通项公式:s...

2019-09-10 01:00:02 328 1

原创 大菜鸡的计算几何之旅-[kuangbin带你飞]专题十三 基础计算几何

大菜鸡的计算几何之旅-[kuangbin带你飞]专题十三 基础计算几何A POJ 2318 TOYSDescriptionCalculate the number of toys that land in each bin of a partitioned toy box.Mom and dad have a problem - their child John never puts h...

2019-08-26 18:22:28 5377

原创 (Codeforces)East Central North America Regional Contest 2016--H Vin Diagrams

(Codeforces)East Central North America Regional Contest 2016–H Vin Diagrams题意用两个不规则的方形表示两个韦恩图,求两个韦恩图的单独部分和公共部分的面积。思路先把这两个图分开,并记录中间的公共部分的圈(中间公共部分的圈是不能接触到整个图的边界的)。然后对空的部分搜索,如果搜索的时候只碰到中间公共部分的圈,则...

2019-08-22 21:53:28 340

原创 2019 年百度之星·程序设计大赛 - 初赛二 1003 度度熊与运算式 1 HDU 6676

2019 年百度之星·程序设计大赛 - 初赛二 1003 度度熊与运算式 1 HDU 6676Problem Description某天度熊发现了一个由 n+1 个数字 1 组成的运算式如下:1 op1 1 op2 1 … 1 opn 1其中 opi 可能是 ⊕ (按位异或运算) 或是 ? (问号)。例如当 n=5 时,式子可能长成这样:1⊕1 ? 1⊕1 ? 1 ? 1现在,度熊想把...

2019-08-19 22:11:50 234

原创 线段树 初探 - BenFromHRBUST

线段树 初探Codeforces Round #197 (Div. 2) 339DProblem DescriptionXenia the beginner programmer has a sequence a, consisting of 2n non-negative integers: a1, a2, …, a2n. Xenia is currently studying bit o...

2019-08-16 13:24:44 199

原创 HDU 2019 Multi-University Training Contest 8 杭电2019多校联合训练赛 第八场 1001 Acesrc and Cube Hypernet (6657)

Problem DescriptionAcesrc is fond of cube nets. If we cut some edges of a cube, the surface of the cube can be unfolded into 2-dimensional space, and the resulting flat shape is called a cube net. Th...

2019-08-15 21:02:38 258

原创 2019牛客暑期多校训练(第九场)J-Symmetrical Painting

2019牛客暑期多校训练(第九场)J-Symmetrical Painting日常膜拜:膜拜鑫爹昊妈还有博文大佬题意给定n个宽为1的矩形,将某些区域删去,使得剩下的图形有一条平行于x轴的对称轴,问怎样使得面积最大,输出最大的面积思路易知,对称轴只可能出现在矩形的两端或者中点处。(如果不在这三个点则面积不会发生突变,即不是极值点)用扫描线去挨个扫过这些可能的点,计算面积,求最...

2019-08-15 20:49:56 176

原创 2019牛客暑期多校训练(第八场)D-Distance

2019牛客暑期多校训练(第八场)D-Distance膜拜UESTC_Trimen的大佬们~原题题意给定一个n* m* h的空间立方体,进行q次操作。第1种操作,向空间体中加入一个点(x,y,z)。第2种操作,找到与(x,y,z)曼哈顿距离最小的点,输出两点间的曼哈顿距离。思路BFS。先将n,m,h的中间值换到高的位置,保证h的值小于500,然后将剩下两维压缩处理(不...

2019-08-13 15:05:04 233

原创 大菜鸡的数论之旅-[kuangbin带你飞]专题十四 数论基础

[kuangbin带你飞]专题十四 数论基础A题 LightOJ 1370 Bi-shoe and Phi-shoeProblem DescriptionBamboo Pole-vault is a massively popular sport in Xzhiland. And Master Phi-shoe is a very popular coach for his success....

2019-08-13 13:49:19 195

原创 大菜鸡的数论之旅-[kuangbin]数学训练四 数论

[kuangbin]数学训练四 数论A题 LightOJ 1007 Mathematically HardProblem DescriptionMathematically some problems look hard. But with the help of the computer, some problems can be easily solvable.In this prob...

2019-08-13 13:48:34 226

原创 HDU 2019 Multi-University Training Contest 7 杭电2019多校联合训练赛 第七场 1006 Final Exam (6651)

HDU 2019 Multi-University Training Contest 7 杭电2019多校联合训练赛 第七场 1006 Final Exam (6651)先膜拜一下牛大佬。skr~Problem DescriptionFinal Exam is coming! Cuber QQ has now one night to prepare for tomorrow’s ex...

2019-08-12 19:45:39 248

原创 2019牛客暑期多校训练(第七场)I-Chessboard

2019牛客暑期多校训练(第七场)J-Just Jump题目描述CSL likes playing tricks very much. The unlucky TL always becomes the target of CSL’s tricks.Today CSL came to trick TL again. He saw that TL has a very very large c...

2019-08-12 00:08:01 427 2

原创 数论训练-高斯消元

数论训练-高斯消元POJ 2065 SETIDescriptionFor some years, quite a lot of work has been put into listening to electromagnetic radio signals received from space, in order to understand what civilizations in d...

2019-08-11 16:10:16 241

原创 大菜鸡的数论之旅-莫比乌斯

大菜鸡的数论之路-莫比乌斯苗神:学屁莫比乌斯啊,学了你也不会,那么菜,学什么莫比乌斯。大菜鸡:???公式打着太麻烦,就直接贴我自己模板里面的公式了。证明:是时候给别人贡献一波访问量了(其实是我懒得打证明了)莫比乌斯函数线性筛模板const int MAXN=50000;int v[MAXN+10];int miu[MAXN+10];int sum[MAXN+10];//求前...

2019-08-11 13:55:08 219

原创 2019牛客暑期多校训练(第八场)J-Just Jump

2019牛客暑期多校训练(第八场)J-Just Jump题意某人要从1走到L点,中间有L-1个点可以走,他每次最少走d步。有m个条件,在第ti步不能走到pi点。问有多少种走法。思路先dp求出没有条件时的方案数。然后容斥一下走到条件位置的方案数(减去走到一个条件位置的方案数,加上走到两个条件位置的方案数……)。坑点所有数组需要用int类型,在乘法或者三个数相加时要先转为LL类型。...

2019-08-11 10:56:45 323 1

原创 2019牛客暑期多校训练(第七场)H-Pair

2019牛客暑期多校训练(第七场)H-Pair牛客复制题目格式太烦了,直接贴截屏了。题意给定A,B,C,问1<=x<=A,1<=y<=B,内有多少组x,y满足(x&y)>C或(x^y)<C。思路数位dp。建立七个维度,第一个维度为dp的位数,第二个第三个维度为当前位a,b的最大值,第四个第五个维度为a,b分别满足题意中的哪种情况,1为满足...

2019-08-10 09:13:07 227

原创 2019牛客暑期多校训练(第五场)C-generator 2

2019牛客暑期多校训练(第五场)C-generator 2题目描述There is a sequence of length n:x0,x1,x2,…,xn−1. Please answer Q queries. Each query consists of one integer v, asking the minimum index i such that xi=v. If the se...

2019-08-09 21:49:44 402 6

原创 Codeforces Round #166 (Div. 2) 271D

Codeforces Round #166 (Div. 2) 271DProblem DescriptionYou’ve got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.A substring s[l…r] (1 ≤ l ≤ r ...

2019-08-09 13:07:05 159

原创 HDU 2019 Multi-University Training Contest 1 杭电2019多校联合训练赛 第一场 1001 Blank (6578)

2019 Multi-University Training Contest 1 杭电2019暑期多校集训第一场 1001 Blank (6578)Problem DescriptionThere are N blanks arranged in a row. The blanks are numbered 1,2,…,N from left to right.Tom is filling ...

2019-08-08 23:10:36 292

原创 HDU 2019 Multi-University Training Contest 5 杭电多校联合训练赛 第五场 1001 fraction(6624)

HDU 2019 Multi-University Training Contest 5 杭电多校联合训练赛 第五场 1001 fraction(6624)Problem DescriptionMany problems require printing the probability of something. Moreover, it is common that if the answe...

2019-08-07 21:25:21 214

原创 树状数组 初探 - BenFromHRBUST

洛谷 P1908 逆序对题目描述猫猫TOM和小老鼠JERRY最近又较量上了,但是毕竟都是成年人,他们已经不喜欢再玩那种你追我赶的游戏,现在他们喜欢玩统计。最近,TOM老猫查阅到一个人类称之为“逆序对”的东西,这东西是这样定义的:对于给定的一段正整数序列,逆序对就是序列中ai>aj且i<j的有序对。知道这概念后,他们就比赛谁先算出给定的一段正整数序列中逆序对的数目。Update:数...

2019-08-06 16:32:48 123

空空如也

空空如也

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

TA关注的人

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