自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(34)
  • 收藏
  • 关注

原创 2018中国大学生程序设计竞赛 - 网络选拔赛 1003 Dream(hdu 6440)(费马小定理)

题目链接hdu 6440 DreamSample Input12 Sample Output0 11 00 00 1题意:重新定义+和*运算,要求小于p的m和n,满足,p为素数 思路:题意比较难懂,但是如果想到了费马小定理,代码是很简单的#include<cstdio>#include<cstring>#include&lt...

2018-08-27 14:59:32 265

原创 FFT(模板)

 #include<cstdio>#include<cstring>#include<cmath>#include<algorithm>#include<iostream>using namespace std;typedef long long ll;//typedef complex<double> C...

2018-08-24 16:23:23 163

原创 莫比乌斯反演(模板)

太难了!看了这个博客:莫比乌斯反演详解 构造是重点,现在看这题: 构造方法和上面的讲解中的构造是基本一致的#include<cstdio>#include<cstring>#include<cmath>#include<algorithm>#include<iostream>using namespac...

2018-08-24 15:51:23 526

原创 求原根(模板)

数论令人头秃,原理就看看别人博客吧:数论之原根#include<cstdio>#include<cstring>#include<cmath>#include<iostream>#include<algorithm>#include <sstream>#include <set>#include

2018-08-24 11:11:28 4165

原创 中国剩余定理(孙子定理)(模板)

中国剩余定理是求解一次同余式组的方法当a互质的时候:#include<iostream>#include<cstdio>#include<climits>#include<cstring>#include<algorithm>using namespace std;int n,m[105],a[105],lcm=...

2018-08-24 11:05:49 308

原创 2018 Multi-University Training Contest 10 1010 Problem J. CSGO(hdu6435)

题目链接:hdu 6435 Problem J. CSGOSample Input22 2 10 2330 6660 1230 4562 2 1100 0 1000 100 1000 100100 0 Sample Output5432000题意:n个主武器,m个副武器,每个武器有一个s值和k个属性,现在选一个主武器,一个副武器,要求两个武器的对应属性值的...

2018-08-22 21:00:43 376

原创 2018 Multi-University Training Contest 10 1012 Problem L.Videos(hdu 6437)(最小费用流)

题目链接:hdu 6437 Problem L.VideosSample Input210 3 1 101 5 1000 05 10 1000 13 9 10 010 3 1 101 5 1000 05 10 1000 03 9 10 0 Sample Output20001990题意:一天有n个小时,m个节目,k个人,以及W,每一个节目从s小时开始t小时...

2018-08-22 20:07:25 189

原创 2018 Multi-University Training Contest 9 1001 Rikka with Nash Equilibrium(hdu 6415)(dp)

题目链接:hdu 6415 Rikka with Nash EquilibriumSample Input23 3 1005 5 2333 Sample Output641170题意: n*m的矩阵,填入1~n*m的数字,若某个数字是这个数字所在行列的最大值,那么这个数字就被称为Nash Equilibrium,现在要求你构造的矩阵只存在一个Nash Equilibr...

2018-08-21 12:47:39 193

原创 牛客网暑期ACM多校训练营(第十场)D Rikka with Prefix Sum

链接:https://www.nowcoder.com/acm/contest/148/D来源:牛客网 题目描述Prefix Sum is a useful trick in data structure problems.For example, given an array A of length n and m queries. Each query gives an inte...

2018-08-19 19:34:35 692

原创 2018 Multi-University Training Contest 8 1010 Taotao Picks Apples(hdu 6406)(ST、dp、二分)

题目链接:hdu 6406 Taotao Picks ApplesSample Input15 31 2 3 4 41 55 52 3 Sample Output153HintFor the first query, the heights of the apples were 5, 2, 3, 4, 4, so Taotao would only pic...

2018-08-15 21:25:14 180

原创 2018 Multi-University Training Contest 8 1001 Character Encoding (hdu 6397)(容斥)

题目链接:hdu 6397 Character EncodingSample Input42 3 32 3 43 3 3128 3 340 Sample Output107903题意:给n,m,k,从0到n-1中取正好m个数字(可以重复取),求这m个数字之和为k的方案数 思路:假设没有0到n-1这个限制条件,那么问题就变成k分为m份有几种方案,这是经典的组...

2018-08-15 19:04:24 182

原创 2018 Multi-University Training Contest 8 1004 Parentheses Matrix(hdu 6400)

题目链接:hdu 6400 Parentheses MatrixSample Input31 12 22 3 Sample Output(())(((())) 题意:n*m的矩阵,由'('或')'组成,空字符串为平衡,若A平衡,则(A)也平衡,若A和B平衡,则AB平衡,输出平衡的行和平衡的列之和最大的情况。思路:首先明确奇数的情况下,不可能是平衡的,所以当...

2018-08-15 17:38:58 131

原创 2018 Multi-University Training Contest 6 1002 bookshelf(hdu 6363)(容斥 | 莫比乌斯反演)

题目链接:hdu 6363 bookshelfSample Input16 8 Sample Output797202805题意:n本书放到k层书架上,放完后,若某一层有x本书,则这一层的稳固值f(x),f是斐波那契数列,美观值为,整个书架的美观值为所有层的美观值的gcd,求书架美观值的期望值。思路:太难了!直接贴题解这个gcd的性质是数论中有的,不会证明,...

2018-08-14 19:54:03 164

原创 2018 Multi-University Training Contest 7 1011 Swordsman(hdu 6396)

题目链接:hdu 6396 SwordsmanSample Input14 37 1 15 5 2 6 3 124 1 1 1 2 10 4 1 5 1 16 0 1 5 3 1 Sample Output323 8 4HintFor the sample, initial V = [7, 1, 1]① kill monster #4 (6, 0, 1)...

2018-08-13 21:49:58 244

原创 输入输出挂

namespace fastIO { #define BUF_SIZE 100000 //fread -> read bool IOerror = 0; inline char nc() { static char buf[BUF_SIZE], *p1 = buf + BUF_SIZE, *pend = buf + BUF_SIZE; if(p1 == pend) { ...

2018-08-13 21:25:51 110

原创 找规律工具

OEIS

2018-08-12 18:50:47 4352

原创 牛客网暑期ACM多校训练营(第八场)G Counting regions(欧拉示性数公式)

链接:https://www.nowcoder.com/acm/contest/146/G来源:牛客网 题目描述Niuniu likes mathematics. He also likes drawing pictures. One day, he was trying to draw a regular polygon with n vertices. He connected e...

2018-08-12 18:23:32 285

原创 牛客网暑期ACM多校训练营(第八场)E Touring cities(哈密尔顿回路)

链接:https://www.nowcoder.com/acm/contest/146/E来源:牛客网 题目描述Niuniu wants to tour the cities in Moe country. Moe country has a total of n*m cities. The positions of the cities form a grid with n rows...

2018-08-12 17:07:25 257

原创 2018 Multi-University Training Contest 6 1009 Werewolf(hdu 6370)(缩点)

题目链接:hdu 6370 Werewolf Sample Input122 werewolf1 werewolf Sample Output0 0题意:n个人,每个人会说x 是狼或者村民,x是除自己以外的任何人,村民不说谎,狼可能说谎,问一定是村民的人的人数和一定是狼的人的人数。思路:如果所有人都是狼,显然成立,所以,一定是村民的人的人数一定是0,然后看图一...

2018-08-08 19:57:04 445

原创 hdu 4417 Super Mario​​​​​​​(主席树)

题目链接:hdu 4417 Super MarioSample Input110 100 5 2 7 5 4 3 8 7 7 2 8 63 5 01 3 11 9 40 1 03 5 55 5 14 6 31 5 75 7 3 Sample OutputCase 1:4003120151 题意:给一个数组,求区间中小于等于h的数字...

2018-08-07 20:27:33 179

原创 ST模板

int a[maxn];int stmin[maxn][20];int stmax[maxn][20];int n,m;//st[i][j]表示[i,i+2^j-1]的最值 void Init(){ int i,j; for(i=1;i<=n;i++) stmin[i][0]=stmax[i][0]=a[i]; for(i=1;(1<<i)<=n;i+...

2018-08-06 21:39:11 290

原创 2018 Multi-University Training Contest 5 G Glad You Came(hdu 6356)(ST)

题目链接:hdu 6356 Glad You CameSample Input41 10 100 1000 1000010 100 1000 10000 100000100 1000 10000 100000 10000001000 10000 100000 1000000 10000000 Sample Output103146337814463342073515...

2018-08-06 21:23:16 221

原创 2018 Multi-University Training Contest 5 B Beautiful Now(hdu 6351)

题目链接:hdu 6351 Beautiful NowSample Input512 1213 2998244353 1998244353 2998244353 3 Sample Output12 21123 321298944353 998544323238944359 998544332233944859 998544332题意:给你数字n和k,可以...

2018-08-06 18:45:43 178

转载 数组全排列

void permutation(vector<vector<int>>& res, vector<int>& num, int index){ if(index >= num.size()){ res.push_back(num); return; } for(int i = in...

2018-08-06 17:52:55 438

原创 牛客网暑期ACM多校训练营(第六场)J Heritage of skywalkert

链接:https://www.nowcoder.com/acm/contest/144/J来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述skywalkert, the new legend of Beihang University ACM-ICPC Team,...

2018-08-04 21:23:58 186

原创 牛客网暑期ACM多校训练营(第六场)C Generation I

链接:https://www.nowcoder.com/acm/contest/144/C来源:牛客网 时间限制:C/C++ 3秒,其他语言6秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述Oak is given N empty and non-repeatable sets which are numbered...

2018-08-04 20:19:41 263

原创 poj 2362 Square​​​​​​​

题目链接:poj 2362 SquareGiven a set of sticks of various lengths, is it possible to join them end-to-end to form a square?InputThe first line of input contains N, the number of test cases. Each test...

2018-08-03 21:17:20 210

原创 hdu 1560 DNA sequence(迭代加深)​​​​​​​

题目链接:hdu 1560 DNA sequence题意:构造一个最短的字符串,使得给出的n个字符串(只包含ACGT)都是这个字符串的字串(可以不连续),输出字符串的长度。思路:最短为n个字符串中最长串的长度,最长为n个字符串长度之和,在这个范围内dfs。具体dfs内容见代码注释#include<cstdio>#include<cstring>#inc...

2018-08-03 17:41:35 145

原创 hdu 2234 无题I (迭代加深)

题目链接:hdu 2234 无题ISample Input21 2 3 41 2 3 41 2 3 42 3 4 14 1 1 11 2 2 22 3 3 33 4 4 4 Sample Output11题意:中文题不说了思路: 第一次做迭代加深的题目,所谓迭代加深,其实就是深搜加上步数,枚举每次要走的步数,依此增加,若当前步数可以使起始状态扩展出...

2018-08-03 17:25:59 218

原创 poj 2251 Dungeon Master

题目链接:poj 2251 Dungeon MasterYou are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute...

2018-08-03 17:17:14 112

原创 hdu 1010 Tempter of the Bone(dfs+剪枝)

题目链接:hdu 1010 Tempter of the Bone(dfs+剪枝)题意:狗狗从S出发,要在正好t秒的时候到达D,每一块地只能走一次,X代表墙不能走,问能否到达思路:深搜,但是需要剪枝,每走一步,判断能否在剩下的时间中不考虑墙通过最短的路到达出口,若不能直接返回。#include<cstdio>#include<cstring>#incl...

2018-08-03 16:58:22 198

原创 2018 Multi-University Training Contest 4 B Harvest of Apples(hdu 6333)(莫队)

 题目链接:hdu 6333 Problem B. Harvest of Apples题意:求思路:T和n的范围都是10的5次,比较大,一直在找规律,各种换算,找一个求得上述式子的快速的方法,但是没找到,看了题解后才知道莫队可以过。n与m变换的过程,需要得到两个式子:这题T了很久,一直不知道为什么,结果发现是因为没有在 ll mod=1e9+7前面加上const,我:???...

2018-08-03 11:07:12 109

原创 牛客网暑期ACM多校训练营(第五场)E-room(带权二分图匹配)

链接:https://www.nowcoder.com/acm/contest/143/E来源:牛客网 题目描述Nowcoder University has 4n students and n dormitories ( Four students per dormitory). Students numbered from 1 to 4n.And in the first ye...

2018-08-02 19:56:16 263

原创 2018 Multi-University Training Contest 4 E Matrix from Arrays(hdu 6336)

 题目链接:hdu 6336 Problem E. Matrix from ArraysSample Input1 3 1 10 1005 3 3 3 32 3 3 32 3 5 85 1 10 109 99 999 1000 Sample Output11011068223833076541 题意:给一个无限的矩阵,给出子矩阵左上角和...

2018-08-01 20:22:23 240

空空如也

空空如也

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

TA关注的人

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