自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 web新手

1.HTML

2018-10-24 20:42:41 232

原创 c#新手教程

List item.结构体的使用using System;using System.Collections;using System.Xml.Serialization;namespace first1017{ struct node { public int id; public int[] gra; } class...

2018-10-17 19:46:16 328

原创 hdu 6299 Balanced Sequence

Chiaki has n strings s1,s2,…,sn consisting of ‘(’ and ‘)’. A string of this type is said to be balanced:if it is the empty stringif A and B are balanced, AB is balanced,if A is balanced, (A) is b...

2018-07-24 14:44:20 184

原创 二分讲解及水题

1.经典模版 定义上下限 #include<bits/stdc++.h>using namespace std;typedef long long ll;const int N=500+1,INF=0x3f3f3f3f;const ll mod=1e9+7;int a[N];int main(){ int l=startpoint,r=endpoint,m...

2018-07-22 19:38:39 168

原创 hdu 2141 Can you find it?

Give you three sequences of numbers A, B, C, then we give you a number X. Now you need to calculate if you can find the three numbers Ai, Bj, Ck, which satisfy the formula Ai+Bj+Ck = X. Input There ...

2018-07-22 19:22:39 187

原创 hdu 1847 Good Luck in CET-4 Everybody!

大学英语四级考试就要来临了,你是不是在紧张的复习?也许紧张得连短学期的ACM都没工夫练习了,反正我知道的Kiki和Cici都是如此。当然,作为在考场浸润了十几载的当代大学生,Kiki和Cici更懂得考前的放松,所谓“张弛有道”就是这个意思。这不,Kiki和Cici在每天晚上休息之前都要玩一会儿扑克牌以放松神经。 “升级”?“双扣”?“红五”?还是“斗地主”? 当然都不是!那多俗啊~ 作为计算...

2018-07-22 14:38:04 180

原创 hdu 2149 Public Sale

虽然不想,但是现实总归是现实,Lele始终没有逃过退学的命运,因为他没有拿到奖学金。现在等待他的,就是像FarmJohn一样的农田生涯。要种田得有田才行,Lele听说街上正在举行一场别开生面的拍卖会,拍卖的物品正好就是一块20亩的田地。于是,Lele带上他的全部积蓄,冲往拍卖会。后来发现,整个拍卖会只有Lele和他的死对头Yueyue。通过打听,Lele知道这场拍卖的规则是这样的:刚开...

2018-07-22 10:58:07 131

原创 博弈理解及水题列表

1.巴什博奕 基础情形 : n个物品,两人轮流从中取1-m个物品,最后先取光者获胜 若n=m+1,先手拿走k个,余下m+1-k个,已知1<=m+1-k<=m,那么后手必胜 现在假设有n=a*(m+1)+b个,先手拿走b个,后手拿走k个,先手拿走m+1-k个,现在余下的有(a-1)*(m+1)个,出现必胜点,先手必胜。 必败态:a*(m+1) 必胜态:a*(m+1)+b...

2018-07-22 10:35:13 184

原创 字符统计问题二

话说实验室有个胖子叫小明,还有个瘦的叫小兵,小兵他已经来了好几天啦,老师也一直叫他练打英文字母,小兵就没有小明听话,他老是偷懒,老师想让他动动脑经,于是就给他出了个问题来惩罚他偷懒。现在我们把两个英文字母的ASCII码的差的绝对值称为这两个字符的“距离”,如果给你一个字符串和上面定义的“距离”的值,问小兵在这个串里最长的连续的子串有多长?当然这个子串的任意两个字符的距离一定不超过给定的距离值!亲爱...

2018-07-16 13:33:16 2388

原创 车牌号问题

大家都知道,一辆汽车上路前先要去交警部门申领汽车号牌,号牌由两部分组成,以点字符“.”为分隔符,点字符“.”前部分是省区标识部分,点字符“.”后部分是五位车牌号,为了能够准确识别车牌,有些容易引起混淆的字符被限制使用,我们假设在某一个车牌系统中有如下限制:1、 车牌是由数字和大写字母组成。2、 考虑到字符“0”和字母“O”很容易引起混淆,因此系统中没有字母“O”。3、 考虑到字符“0”...

2018-07-13 15:56:58 2632

原创 二叉树遍历问题

给定二叉树的先序遍历和后序遍历,计算可能有几棵二叉树Input 本问题有多组测试数据,第一行是测试数据的组数n,紧接着是n组测试数据。每组测试数据有两行,分别表示二叉树的先序遍历和后序遍历,每个结点用大写字母表示,输入保证数据是正确的。Output 对于每一组输入,对应的输出只有一行,即符合给定的先序遍历和后序遍历这样条件的二叉树的棵数。Sample Input 1 AB...

2018-07-13 15:53:01 314

原创 勾股数

勾股定理是我们中华名族的骄傲,可惜在很多书上都不是这样命名的。今天我们来算算勾股数,也就是说给定一个正整数N,找出所有小于N的三个正整数a,b,c,满足:a*a+b*b=c*c,且a<=b#include<bits/stdc++.h>using namespace std;typedef long long ll;const int N=1000000+7,INF=0x...

2018-07-11 16:42:23 1900 2

原创 hdu 2521 反素数

反素数就是满足对于任意i(0#include <bits/stdc++.h>using namespace std;typedef long long ll;const int N=30+7,INF=0x3f3f3f3f;const ll mod=10000;int main(){ int t; scanf("%d",&t); while...

2018-07-10 21:23:32 187

原创 hdu 2519 新生晚会

开学了,杭电又迎来了好多新生。ACMer想为新生准备一个节目。来报名要表演节目的人很多,多达N个,但是只需要从这N个人中选M个就够了,一共有多少种选择方法? Input 数据的第一行包括一个正整数T,接下来有T组数据,每组数据占一行。 每组数据包含两个整数N(来报名的人数,1<=N<=30),M(节目需要的人数0<=M<=30) Output 每组数据输出一个整数...

2018-07-10 20:40:37 126

原创 确定比赛名次

有N个比赛队(1<=N<=500),编号依次为1,2,3,。。。。,N进行比赛,比赛结束后,裁判委员会要将所有参赛队伍从前往后依次排名,但现在裁判委员会不能直接获得每个队的比赛成绩,只知道每场比赛的结果,即P1赢P2,用P1,P2表示,排名时P1在P2之前。现在请你编程序确定排名。Input 输入有若干组,每组中的第一行为二个数N(1<=N<=500),M;其中N表示...

2018-07-09 21:30:48 161

原创 判断点是否在三角形内

#include<bits/stdc++.h>using namespace std;typedef long long ll;struct node{ double x,y;};double dis(node a,node b)//算距离{ double dx=a.x-b.x; double dy=a.y-b.y; return sqrt...

2018-07-09 18:59:33 397

原创 最大字段和模板

只要求返回最大值#include<bits/stdc++.h>using namespace std;typedef long long ll;const int N=1e3+7,INF=0x3f3f3f3f;int a[N],dp[N];int main(){ int n; while(~scanf("%d",&n))

2018-07-09 14:00:20 194

原创 二叉树遍历模板 (前中求后、后中求前)

前中求后#include <bits/stdc++.h>using namespace std;typedef long long ll;const int N=5e4+7,INF=0x3f3f3f3f;int in[N],pre[N];int n,k;void dfs(int l,int r,int rt){ int i; for(i=l;in[i]...

2018-07-08 14:22:35 272

原创 pku 1182 食物链 (带权并查集)

详解动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法对这N个动物所构成的食物链关系进行描述: 第一种说法是”1 X Y”,表示X和Y是同类。 第二种说法是”2 X Y”,表示X吃Y。 此人对N个动物,用上述两种说法,一句...

2018-07-07 13:45:50 209

原创 zoj 3938 Defuse the Bomb

(http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3938)The bomb is about to explode! Please defuse it as soon as possible!There is a display showing a number from 1 to 4 on the bomb. B...

2018-05-27 14:06:37 210

原创 Gym - 101775A Chat Group

It is said that a dormitory with 6 persons has 7 chat groups ^_^. But the number can be even larger: since every 3 or more persons could make a chat group, there can be 42 different chat groups.Given N

2018-05-05 21:13:27 1285

原创 poj 2104 K-th Number

理解自:(https://blog.csdn.net/tree__water/article/details/80090450)You are working for Macrohard company in data structures department. After failing your previous task about key insertion you were ask...

2018-05-03 18:15:38 116

原创 ZOJ 3603 Draw Something Cheat

Have you played Draw Something? It’s currently one of the hottest social drawing games on Apple iOS and Android Devices! In this game, you and your friend play in turn. You need to pick a word and draw

2018-04-25 19:55:46 126

原创 hdu 1060 Leftmost Digit

Given a positive integer N, you should output the leftmost digit of N^N. Input The input contains several test cases. The first line of the input is a single integer T which is the number of test cas

2018-04-18 21:07:29 96

原创 CodeForces 676C Vasya and String

High school student Vasya got a string of length n as a birthday present. This string consists of letters ‘a’ and ‘b’ only. Vasya denotes beauty of the string as the maximum length of a substring (cons

2018-04-17 21:45:21 165

原创 zoj 3946 Highway Project

Edward, the emperor of the Marjar Empire, wants to build some bidirectional highways so that he can reach other cities from the capital as fast as possible. Thus, he proposed the highway project.The...

2018-04-07 13:33:14 98

原创 pta 家庭房产

给定每个人的家庭成员和其自己名下的房产,请你统计出每个家庭的人口数、人均房产面积及房产套数。 输入格式:输入第一行给出一个正整数N(≤1000),随后N行,每行按下列格式给出一个人的房产: 编号 父 母 k 孩子1 … 孩子k 房产套数 总面积 其中编号是每个人独有的一个4位数的编号;父和母分别是该编号对应的这个人的父母的编号(如果已经过世,则显示-1);k(0≤k≤5)是该人的子女的个...

2018-03-25 20:42:19 2374 1

原创 bfs + 状压

一.初始化起点状态 二.bfs 1.起点推入 2.每次从队列中弹出一个点 3.针对这个点的周围的点,判断其边界是否合法,如果合法,将状态转移,推入队列。()

2017-11-28 23:32:00 386

原创 hdu 1102

最小生成树 一.prime 算法 直接暴力每个点,以每个点为起点找出最优解(距离最短)#include <bits/stdc++.h>using namespace std;typedef __int64 ll;const int N=107,INF=0x3f3f3f3f;int cost[N][N],lc[N],vis[N];int n;int prime(){ for(

2017-11-28 17:06:49 166

原创 hdu 1520 (树形dp)

There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees. It means that the supervisor relation forms a tre

2017-10-02 21:56:53 360

原创 HDU 3635 Dragon Balls(带权并查集)

His country has N cities and there are exactly N dragon balls in the world. At first, for the ith dragon ball, the sacred dragon will puts it in the ith city. Through long years, some cities’ dragon ba

2017-09-22 22:09:03 156

原创 扩展欧几里德算法

原理 : 定义 ax+by=gcd(a,b)*k 一定会有解 所以公式变形为 ax+by=d gcd(a,b)|d d能整除gcd(a,b)ll ex_gcd(ll a,ll b,ll x,ll y){ if(!b) { x=1; y=0; return a; } ll g=ex_gcd(b,a%b,x,y),

2017-07-31 23:52:53 227

原创 素数 快速幂 gcd.lcm

一 素数1.判断一个数是不是素数 如果x<=1 则不是素数 是素数返回true 不是则返回falsebool is_pri(ll x) //时间复杂度O(√n){ ll s=sqrt(x+0.5); //加0.5是为了防止精度误差 for(ll i=2;i<=s;i++) if(!(x%i)) return false; return

2017-07-31 17:18:24 308

原创 矩阵快速幂模版

const ll mod=1000;const int N=4;struct node{ ll a[N][N]; void init() { for(int i=0;i&lt;N;i++) for(int j=0;j&lt;N;j++) a[i][j]=0; for(int i=0...

2017-07-24 18:27:20 176

原创 链式前向星

#include <cstdio>#include <cstring>#include <string>#include <algorithm>#include <iostream>#include <map>#include <queue>#include <cmath>#include <vector>using namespace std;typedef long long

2017-07-22 18:42:10 256

原创 RMQ 求区间最值

pku 3264#include <cstdio>#include <cstring>#include <string>#include <algorithm>#include <iostream>#include <map>#include <queue>#include <cmath>#include <vector>using namespace std;typedef

2017-07-20 12:10:26 272

原创 HDU 1466 计算直线的交点数

平面上有n条直线,且无三线共点,问这些直线能有多少种不同交点数。 比如,如果n=2,则可能的交点数量为0(平行)或者1(不平行)。 Input 输入数据包含多个测试实例,每个测试实例占一行,每行包含一个正整数n(n<=20),n表示直线的数量. Output 每个测试实例对应一行输出,从小到大列出所有相交方案,其中每个数为可能的交点数,每行的整数之间用一个空格隔开。 Sample Inp

2017-07-20 10:24:03 195

原创 SHU A序列 (最大上升子序列)

A序列描述 如果一个序列有奇数个正整数组成,不妨令此序列为a1,a2,a3,…,a2∗k+1(0<=k),并且a1,a2…ak+1是一个严格递增的序列,ak+1,ak+2,…,a2∗k+1,是一个严格递减的序列,则称此序列是A序列。比如1 2 5 4 3就是一个A序列。现在Jazz有一个长度为n的数组,他希望让你求出这个数组所有满足A序列定义的子序列里面最大的那个长度。(子序列可以不连续)比如1

2017-07-10 20:13:26 421

原创 HDU 2369 尺取法

Bruce Force’s keyboard is broken, only a few keys are still working. Bruce has figured out he can still type texts by switching the keyboard layout whenever he needs to type a letter which is currently

2017-07-08 21:50:27 204

原创 HDU 1028 (母函数或者dp)

“The second problem is, given an positive integer N, we define an equation like this: N=a[1]+a[2]+a[3]+…+a[m]; a[i]>0,1<=m<=N; My question is how many different equations you can find for a give

2017-07-02 11:19:36 393

空空如也

空空如也

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

TA关注的人

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