自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

zhe

能力有限,如果有错的地方大家可以指出来

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

原创 第七周题解

F.奇偶交换思路:对于串中的每一个数字,如果它是奇数(偶数)的话,无论它怎么交换,之前在它前面的奇数(偶数)还是在它前面,所以你可以把奇数和偶数分离出来,顺序还是和它在原串中的奇数(偶数)顺序不变,然后进行偶数和奇数比较,小的就先输出来#include<stdio.h>#include<string.h>#include<algorithm>#incl...

2019-12-08 17:19:23 455

原创 HDU 2298 Toxophily (三分+二分)

ToxophilyThe recreation center of WHU ACM Team has indoor billiards, Ping Pang,chess and bridge, toxophily, deluxe ballrooms KTV rooms, fishing,climbing, and so on. We all like toxophily.Bob is ...

2019-11-28 16:13:09 156 1

原创 POJ 3273 Monthly Expense(二分)

Monthly ExpenseFarmer John is an astounding accounting wizard and has realized hemight run out of money to run the farm. He has already calculated andrecorded the exact amount of money (1 ≤ moneyi...

2019-11-27 20:53:09 123

原创 POJ 3258 River Hopscotch(二分法)

River HopscotchEvery year the cows hold an event featuring a peculiar version ofhopscotch that involves carefully jumping from rock to rock in ariver. The excitement takes place on a long, straigh...

2019-11-27 20:33:49 175

原创 HDU 2199 Can you solve this equation?(二分)

Can you solve this equation?Now,given the equation 8x^4 + 7x^3 + 2x^2 + 3x + 6 == Y,can youfind its solution between 0 and 100; Now please try your lucky.InputThe first line of the input conta...

2019-11-25 15:54:54 117

原创 POJ 2566 Bound Found(尺取的进阶)

Signals of most probably extra-terrestrial origin have been receivedand digitalized by The Aeronautic and Space Administration (that mustbe going through a defiant phase: “But I want to use feet, n...

2019-11-25 11:34:08 87

原创 背包模板整理

1. 01背包 /* n表示有n件物品,v表示总共的容量 c[i]表示第i件物品的容量,w[i]表示第i件物品的价值 */ for(i=1;i<=n;i++) { for(j=v;j>=c[i]; j--) { dp[j]=max(dp[j], dp[j-c[i]]+w[i]); ...

2019-11-23 14:09:22 104

原创 牛客挑战赛34 A.能天使的愿望(分组背包)

链接:https://ac.nowcoder.com/acm/contest/2271/A来源:牛客网时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 65536K,其他语言131072K 64bit IO Format:%lld题目描述出题人寄给大家的一些闲话:参加了CSP-J/S 2019 的同学,考的都怎么样啊?不论是 500+ 收获省一而归的大佬,还是 100+...

2019-11-23 10:06:02 331

原创 POJ 3320 Jessica's Reading Problem (尺取法)

Jessica’s Reading ProblemTime limitMemory limitOS1000 ms65536 kBLinuxJessica’s a very lovely girl wooed by lots of boys. Recently she has aproblem. The final exam is coming, yet she...

2019-11-22 18:23:33 111

原创 网络流小结

最大流算法模板最小费用最大流模板最大费用最大流解法:1.把所有费用变成相反数跑一遍最小费用最大流,输出答案的相反数。2.初始化spfa时dis数组全从INF改为-INF,松弛的条件从 dis[i]>dis[j]+cost[i,j]改为dis[i]<dis[j]+cost[i,j]最小割:(1)最小割定义:假设在原图中,删掉某些边,能够使得从s出发到不了t,则这些边的集...

2019-11-22 15:22:04 83

原创 UVA 10480(最小割/最大流/路径输出)

SabotageThe regime of a small but wealthy dictatorship has been abruptly overthrown by an unexpected rebellion.Because of the enormous disturbances this is causing in world economy, an imperialist m...

2019-11-22 15:19:30 120

原创 网络流最大流 ek算法模板和dinic模板

ek+邻接矩阵#include<stdio.h>#include<string.h>#include<algorithm>#include<iostream>#include<queue>using namespace std;const int maxn=205;int v[maxn][maxn];int pre[ma...

2019-11-19 21:23:45 121

原创 Educational Codeforces Round 76 (Rated for Div. 2) D. Yet Another Monster Killing Problem

Yet Another Monster Killing ProblemYou play a computer game. In this game, you lead a party of m heroes, and you have to clear a dungeon with n monsters. Each monster is characterized by its power ai...

2019-11-18 21:25:01 146

原创 POJ 1459 Power Network(最大流 ek算法 邻接矩阵建图)

Power NetworkA power network consists of nodes (power stations, consumers anddispatchers) connected by power transport lines. A node u may besupplied with an amount s(u) >= 0 of power, may prod...

2019-11-18 15:51:26 197

原创 费用流模板 ek+spfa和 dinic+spfa

ek+spfa#include<iostream>#include<algorithm>#include<cstdio>#include<cstring>#include<queue>#include<string>#define ll long longusing namespace std;const i...

2019-11-16 15:57:08 204

原创 ACM比赛中最大值inf的设定

在ACM的比赛中很多时候会用到最大值一般的话在int范围内定义最大值inf=0x3f3f3f3f, 因为0x3f3f3f3f的十进制值为1061109567 ,2* (0x3f3f3f3f)<int范围内最大值,不会因为inf+inf的计算而爆int范围在 long long int 的范围内 令 inf=0x3f3f3f3f3f3f3f3f ,此时inf的值为45574308887...

2019-11-14 21:15:04 956

原创 HDU 6608 Fansblog (Miller_Rabin+威尔逊定理+费马小定理)

FansblogFarmer John keeps a website called ‘FansBlog’ .Everyday , there aremany people visited this blog.One day, he find the visits has reachedP , which is a prime number.He thinks it is a intere...

2019-11-12 18:55:35 143

原创 快速幂取模和快速积取模模板

快速幂取模long long ksm(long long a,long long b,long long mod){ long long ans=1; while (b) { if (b&1) ans=(ans*a)%mod; a=(a*a)%mod; b>>=1; } return (ans)%m...

2019-11-11 11:34:41 179 1

原创 POJ 3436 ACM Computer Factory (网络流 dinic算法)

ACM Computer FactoryAs you know, all the computers used for ACM contests must beidentical, so the participants compete on equal terms. That is why allthese computers are historically produced at t...

2019-11-07 19:21:11 142

原创 Codeforces Round #595 (Div. 3) C Good Numbers

题目链接题意:就是给你一个数n,让你求出最小的数k,这个数大于等于n,同时这个数可以写成 k=3x+3y+… 3z 保证x!=y!=z!=…, 让你求出符合条件的最小的k思路:这个题的话可以通过枚举3的倍数,能减的话(符合 k-i>=n的情况下)直接把它减去了,相当于是把3的倍数全都枚举了,时间复杂度的话应该是 t*log 3n#include<bits/stdc++.h>...

2019-11-05 19:34:34 66

原创 POJ 3281 Dining(最大流 - EK算法)

DiningCows are such finicky eaters. Each cow has a preference for certainfoods and drinks, and she will consume no others.Farmer John has cooked fabulous meals for his cows, but he forgot tocheck...

2019-10-31 21:36:03 127

原创 Educational Codeforces Round 75 (Rated for Div. 2)

题目链接:http://codeforces.com/contest/1251B. Binary Palindromes题意:告诉你n个含有数字0和1的串,你可以进行操作,交换两个位置的数字,问你通过操作后最多可以得到多少个回文串思路:数字只有0和1,那就好办了,在n个字符串中,如果字符串的长度为奇数,那么中间那个位置随便放,如果字符串的长度为偶数的话,那么只有成对的1和0才能组成回文数,所...

2019-10-30 21:30:24 133

原创 POJ 1463 Strategic game(树形dp入门)

Strategic gameBob enjoys playing computer games, especially strategic games, butsometimes he cannot find the solution fast enough and then he is verysad. Now he has the following problem. He must ...

2019-10-29 21:41:13 158

原创 HDU 2196 Computer(经典树形dp)

A school bought the first computer some time ago(so this computer’s idis 1). During the recent years the school bought N-1 new computers.Each new computer was connected to one of settled earlier. M...

2019-10-29 21:13:53 184 1

原创 POJ 1470 Closest Common Ancestors (LCA 离线算法)

Closest Common AncestorsWrite a program that takes as input a rooted tree and a list of pairs of vertices. For each pair (u,v) the program determines the closest common ancest...

2019-10-28 11:28:51 128

原创 表达式求值模板

保留两位小数// AC(动态规划)#include<stdio.h>#include<string.h>int len;int fst[1005];char str[1005];double Jud(int begin, int end); /*计算并返回表达式在区间[begin end]中的值*/int main(){ int T, i; ...

2019-10-25 17:15:04 157

原创 KMP总结

自己的模板判断模式串在总串的哪个位置开始出现#include <iostream>#include<algorithm>#include<string.h>#include<stdio.h>using namespace std;int ne[10005];int s[1000005],p[10005];int m,n;void ...

2019-10-25 16:07:36 100

转载 逆元

概念:对于两个数a,p,如果存在gcd(a,p)=1,则一定存在另一个数x,使得 ax ≡ 1(mod p),并称此时的x为a关于1模p的乘法逆元,如果化成式子来说的话就是 ax = p*k+1,存在x和k使式子存在求逆元的方法:1.扩展欧几里得LL exgcd(LL a,LL b,LL &x,LL &y)//扩展欧几里得算法 { if(b==0) { ...

2019-10-25 16:06:23 83

原创 中国剩余定理模板

对于x≡ v (mod s) (s0,s2,…sn-1)两两互质对于n组v和s,求出较小的 满足式子的x的值#include <iostream>#include<stdio.h>using namespace std;const int MAXN = 100;int n, v[MAXN], s[MAXN]; //必要的时候用long longint e...

2019-10-25 15:49:49 91

原创 博弈论算法

巴什博弈:两个顶尖聪明的人在玩游戏,有一堆nn个石子,每次每个人能取[1,m][1,m]个石子,不能拿的人输,请问先手与后手谁必败?结论:通过上面的分析可以得出结论:当nn能整除m+1m+1时先手必败,否则先手必胜。尼姆博弈(Nim):两个顶尖聪明的人在玩游戏,有nn堆石子,第ii堆有aiai个,每人每次能从一堆石子中取任意多个石子但不能不取,不能拿的人输,请问先手与后手谁必胜?结论:...

2019-10-23 19:06:29 259

原创 <bitsit>算法

< bitset >头文件bitset是用来存放bit位元素的,由于每个元素(0或1)只占1bit位,因而可以节约空间(相比于8bit位的bool型变量)。在c++ stl中,提供了操作位的容器,使用前包含< bitset >头文件即可。相关操作创建bitset对象如bitset<100> b,它能容纳100位比特位,每位上的初始值为0注意:bitse...

2019-10-23 18:52:08 242

原创 数论中的一些定义以及运算

1.设m是一个正整数,则m个整数1,…,m-1,m中与m互素的整数的个数,记作φ(m),通常叫做欧拉函数2.设m,n是互素的两个正整数,则 φ(m*n)=φ(m)*φ(n)3.设m是大于1的整数,如果a是满足(a,m)=1的整数,则 aφ(m)≡1(mod m) 欧拉函数...

2019-10-23 16:08:31 479

原创 扩展欧几里得算法

说明了对任何整数a、b和它们的最大公约数dax + by = m 有整数解时当且仅当m是d的倍数。特别来说,方程 ax+by=1 有整数解当且仅当整数a和b互素。int exgcd(int a, int b, int &x, int &y){ if(b == 0) {//推理1,终止条件 x = 1; y = 0; ...

2019-10-22 20:19:48 65

原创 牛客练习赛 53 ABC 题解

A题目描述超越学姐非常喜欢自己的名字,以至于英文字母她只喜欢“c”和“y”。因此超越学姐喜欢只含有“c”和“y”的字符串,且字符串中不能出现两个连续的“c”。请你求出有多少种长度为n的字符串是超越学姐喜欢的字符串。答案对1e9+7取模。输入描述:输入一个整数n。1<=n<=100000输出描述:输出一个整数表示答案。示例1输入复制3输出复制5说明cyy,...

2019-10-12 16:55:54 263

原创 Codeforces Round #589 (Div. 2) C Primes and Multiplication

Let’s introduce some definitions that will be needed later.Let prime(x) be the set of prime divisors of x. For example, prime(140)={2,5,7}, prime(169)={13}.Let g(x,p) be the maximum possible integer...

2019-10-08 21:04:16 86

原创 HDU 4857 拓扑排序(优先队列+逆存数)

糟糕的事情发生啦,现在大家都忙着逃命。但是逃命的通道很窄,大家只能排成一行。现在有n个人,从1标号到n。同时有一些奇怪的约束条件,每个都形如:a必须在b之前。同时,社会是不平等的,这些人有的穷有的富。1号最富,2号第二富,以此类推。有钱人就贿赂负责人,所以他们有一些好处。负责人现在可以安排大家排队的顺序,由于收了好处,所以他要让1号尽量靠前,如果此时还有多种情况,就再让2号尽量靠前,如果还有...

2019-09-12 21:32:04 126

原创 Manthan, Codefest 19 (open for everyone, rated, Div. 1 + Div. 2) B. Uniqueness

You are given an array a1,a2,…,an. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.In other words, at most one time you can choose two integers l and...

2019-09-06 20:11:35 84

原创 Educational Codeforces Round 71 (Rated for Div. 2) B

You are given two matrices A and B. Each matrix contains exactly n rows and m columns. Each element of A is either 0 or 1; each element of B is initially 0.You may perform some operations with matrix...

2019-08-24 11:01:33 128

原创 HDU 1595 find the longest of the shortest

Marica is very angry with Mirko because he found a new girlfriend and she seeks revenge.Since she doesn’t live in the same city, she started preparing for the long journey.We know for every road how m...

2019-08-22 18:02:31 75

原创 Codeforces Round #580 (Div. 2) C. Almost Equal

You are given integer n. You have to arrange numbers from 1 to 2n, using each of them exactly once, on the circle, so that the following condition would be satisfied:For every n consecutive numbers o...

2019-08-22 17:48:57 176

hotel.sql

hotel.sql

2023-01-06

空空如也

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

TA关注的人

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