- 博客(46)
- 资源 (6)
- 收藏
- 关注
原创 Codeforces Round #318 [RussianCodeCup Thanks-Round] (Div. 1)A,B
A. Bear and PokerLimak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the
2015-08-31 14:02:54 416
原创 我的第一个python类
class Test(object): def __init__(self,name ,phone): self.name=name self.phone=phone print('Create instance for:',self.name) def updatePhone(self,phone): self.pho
2015-08-29 21:36:15 371
原创 2012 ACM/ICPC Asia Regional Changchun Online(hdu 4267 - 4277)线段树+dp+dfs+树形dp
A Simple Problem with IntegersProblem Description Let A1, A2, … , AN be N elements. You need to deal with two kinds of operations. One type of operation is to add a given number to a few numbers in a
2015-08-28 13:20:51 519
原创 python itertools模块
itertools — Functions creating iterators for efficient loopingThis module implements a number of iterator building blocks inspiredby constructs from APL, Haskell, and SML. Each has been recast
2015-08-27 21:37:36 782
原创 2013 Multi-University Training Contest 9(hdu 4686 - 4691)dp(好)+矩阵快速幂+一般图匹配带花树+后缀数组
A - 1001DescriptionAn Arc of Dream is a curve defined by following function:AoD(n)=∑n−1i=0ai∗biAoD(n)=\sum_{i=0}^{n-1}a_i*b_iwhere a0=A0a_0 = A_0 ai=ai−1∗AX+AYa_i = a_{i-1}*AX+AY b0=B0b_0 = B_0 bi=
2015-08-27 14:38:32 479
原创 python yield生成器
下面是学习生成器的比较好的博客,本文的大部分内容也是借鉴的这些博客: python 模拟 linux shell 下的 tail -f 动态打印日志 python yield生成器 提高你的Python: 解释‘yield’和‘Generators(生成器)’ python关键字yield的解释 Python yield 使用浅析 Python Generators(生成器)——yie
2015-08-27 11:34:03 426
原创 hdu - 4687 Boke and Tsukkomi(一般图带花树匹配)
Boke and Tsukkomi Time Limit: 3000/3000 MS (Java/Others) Memory Limit: 102400/102400 K (Java/Others) Total Submission(s): 846 Accepted Submission(s): 249Problem Description A new season of Tou
2015-08-26 22:53:56 633
原创 一般图带花树匹配(URAL - 1099)模板
好久之前就想学一下什么是带花树,今天做了套题,终于看了看,不过目前的水平也就是理解它的大体思想,至于实现的细节,真的是无力。 下面推荐几个讲解的博客: 无向图匹配的带花树算法 带花树(一般图最大匹配) 在北京冬令营的时候,yby提到了“带花树开花”算法来解非二分图的最大匹配。 于是,我打算看看这是个什么玩意。其实之前,我已经对这个算法了解了个大概,但是。。。真的不敢去写。 有一个叫Gal
2015-08-26 22:26:00 1676 1
原创 python偏函数
偏函数固化第一个参数为固定参数,并返回另一个带n-1个参数函数对象,跟c++11的bind一样的作用from operator import add,mulfrom functools import partialadd1=partial(add,1)mul10=partial(mul,10)print(add1(10))print(mul10(10))print(int('100010')
2015-08-25 11:34:24 439
原创 python函数式编程内建函数filter,map,reduce函数
1. filter函数filter函数会对指定序列执行过滤操作。 filter函数的定义: filter(function or None, sequence) -> list, tuple, or string function是一个谓词函数,接受一个参数,返回布尔值True或False。 filter函数会对序列参数sequence中的每个元素调用function函数,最后返回的结果包含
2015-08-25 11:11:03 766
原创 python装饰器和闭包
下面几个博客有装饰器的讲解,也包含了装饰器几种情况的例子,比如说被装饰的函数带参数,装饰器本身带参数等。 理解python中的装饰器 python装饰器学习(例子) 其实装饰器跟设计模式中的装饰器模式基本一样,就是在已有的函数上添加新的功能,这也是自己对装饰器的一点简陋的理解了。下面是自己写的简单例子,不含参数的 用来显示函数被调用的时间from time import ctime,slee
2015-08-25 09:45:40 530
原创 Codeforces Round #317 [AimFund Thanks-Round] (Div. 1)(组合数学+容斥)
A. Lengthening SticksYou are given three sticks with positive integer lengths of a, b, and c centimeters. You can increase length of some of them by some positive integer number of centimeters (differe
2015-08-24 17:41:24 496
原创 python函数(模拟算数游戏)
本程序每次随机产生两个10以内的整数,然后对其进行+-操作,然后对用户输入结果进行判断,用到了operator模块的add,sub python Document operatorfrom operator import add,subfrom random import randint,choiceops={'+':add,'-':sub}def init(): op=choice
2015-08-22 22:14:01 1020
原创 2015 Multi-University Training Contest 10 (hdu 5406-5416)数据结构+dp+矩阵快速幂+bitset优化拓扑排序+(dp&树状数组)
CRB and CandiesProblem DescriptionCRB has N different candies. He is going to eat K candies. He wonders how many combinations he can select. Can you answer his question for all K(0≤K≤N)?K(0 ≤ K ≤ N)?
2015-08-21 16:40:54 764
原创 2015暑假训练(UVALive 5983 - 5992)线段树离线处理+dp+floyed最短路
A: http://acm.hust.edu.cn/vjudge/contest/view.action?cid=83690#problem/A 题意:N*M的格子,从左上走到右下,要求在每个点的权值必须大于0,问起始的时候必须有多少能量 思路:二分答案#include<iostream>#include<cstdio>#include<string>#include<cstring>#
2015-08-19 19:39:23 689 2
原创 2015 Multi-University Training Contest 9(区间dp)
ExpressionProblem DescriptionTeacher Mai has n numbers a1,a2,⋯,anand n−1 operators(“+”, “-” or “*”)op1,op2,⋯,opn−1, which are arranged in the form a1 op1 a2 op2 a3 ⋯ an.He wants to erase numbers one by
2015-08-18 20:49:55 488
原创 2014 ACM/ICPC Asia Regional Beijing Online(hdu5036 概率+bitset优化)
ExplosionProblem DescriptionEveryone knows Matt enjoys playing games very much. Now, he is playing such a game. There are N rooms, each with one door. There are some keys(could be none) in each room co
2015-08-17 21:48:26 873
原创 暑假训练(UVALive 5789-5799)(线段树+并查集+dp+桥)
A :http://acm.hust.edu.cn/vjudge/contest/view.action?cid=83308#problem/A 题意:将区间(l,r)的人杀掉,并且输出左边和右边第一个没死的人 思路:线段树,或者并查集#include<iostream>#include<cstdio>#include<string>#include<cstring>#include<v
2015-08-17 20:43:51 495
原创 2014 ACM/ICPC Asia Regional Beijing Online(hdu5040)优先队列BFS
InstrusiveProblem DescriptionThe legendary mercenary Solid Matt gets a classic mission: infiltrate a military base.The military base can be seen as an N * N grid. Matt’s target is in one of the grids a
2015-08-16 23:41:23 427
原创 python字典模拟登陆
db={}def newuser(): prompt='Login desired: ' while True: name=input(prompt) if name in db: prompt='name taken,try again' else: break; pwd=in
2015-08-16 20:37:49 743
原创 2015 Multi-University Training Contest 8 (莫对算法+AC自动机+DP)
DanganronpaProblem DescriptionDanganronpa is a video game franchise created and developed by Spike Chunsoft, the series’ name is compounded from the Japanese words for “bullet” (dangan) and “refutation
2015-08-16 15:50:06 931
原创 Codeforces Round #316 (Div. 2)E. Pig and Palindromes(dp好题)
E. Pig and PalindromesPeppa the Pig was walking and walked into the forest. What a strange coincidence! The forest has the shape of a rectangle, consisting of n rows and m columns. We enumerate the row
2015-08-16 10:30:42 1012
原创 Codeforces Round #316 (Div. 2)dfs序
B. Simple GameOne day Misha and Andrew were playing a very simple game. First, each player chooses an integer in the range from 1 to n. Let’s assume that Misha chose number m, and Andrew chose number a
2015-08-15 22:26:37 372
原创 python实现栈和队列
利用python列表的操作,利用菜单的形式实现栈stack=[]def push(): stack.append(input('enter: ').strip())def pop(): if len(stack)==0: print('connot pop from an empty stack') else : print('Remove
2015-08-15 11:15:19 607
原创 2015 Multi-University Training Contest 6(hdu5362 - Just A String)dp求期望
Just A StringProblem Descriptionsoda has a random string of length n which is generated by the following algorithm: each of n characters of the string is equiprobably chosen from the alphabet of size m
2015-08-12 15:02:12 419
原创 2015 Multi-University Training Contest 7(hdu5371、5372、5373、5375、5378、5379)(dp+概率Manachar+dfs计数+树状数组)
Hotaru’s problemProblem DescriptionHotaru Ichijou recently is addicated to math problems. Now she is playing with N-sequence. Let’s define N-sequence, which is composed with three parts and satisfied
2015-08-11 23:28:50 526
原创 2015 Multi-University Training Contest 6 (hdu 5357 - Easy Sequence)栈的应用
Easy Sequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 643 Accepted Submission(s): 185Problem Description soda has a string conta
2015-08-11 20:19:18 464
原创 ZOJ 3541 - The Last Puzzle(区间dp)
The Last PuzzleThere is one last gate between the hero and the dragon. But opening the gate isn’t an easy task.There were n buttons list in a straight line in front of the gate and each with an integer
2015-08-11 10:28:10 586
原创 ZOJ 3543 - Number String(dp)
Number StringThe signature of a permutation is a string that is computed as follows: for each pair of consecutive elements of the permutation, write down the letter ‘I’ (increasing) if the second eleme
2015-08-10 17:09:37 530
原创 ZOJ 3547 - The Boss on Mars(容斥)
The Boss on MarsOn Mars, there is a huge company called ACM (A huge Company on Mars), and it’s owned by a younger boss.Due to no moons around Mars, the employees can only get the salaries per-year. The
2015-08-10 17:01:01 578
原创 zoj 3545 - Rescue the Rabbit(AC自动机+dp)
Rescue the RabbitDr. X is a biologist, who likes rabbits very much and can do everything for them. 2012 is coming, and Dr. X wants to take some rabbits to Noah’s Ark, or there are no rabbits any more.A
2015-08-10 16:51:25 512
原创 BestCoder Round #50 (div.2) hdu5366、5367(dp+动态线段树)
The mook jong问题描述ZJiaQ为了强身健体,决定通过木人桩练习武术。ZJiaQ希望把木人桩摆在自家的那个由1*1的地砖铺成的1*n的院子里。由于ZJiaQ是个强迫症,所以他要把一个木人桩正好摆在一个地砖上,由于木人桩手比较长,所以两个木人桩之间地砖必须大于等于两个,现在ZJiaQ想知道在至少摆放一个木人桩的情况下,有多少种摆法。输入描述输入有多组数据,每组数据第一行为一个整数n(1 <
2015-08-09 19:42:45 616
原创 2015 Multi-University Training Contest 6(hdu5353-5363)
欢迎参加——每周六晚的BestCoder(有米!) Average Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 1748 Accepted Submission(s): 447 Special JudgeProblem
2015-08-09 10:43:58 475
原创 Codeforces Round #Pi (Div. 2)(最短路重建图+tarjan重边找桥)
C. Geometric ProgressionPolycarp loves geometric progressions very much. Since he was only three years old, he loves only the progressions of length three. He also has a favorite integer k and a sequen
2015-08-08 11:28:14 462
原创 Codeforces Round #Pi (Div. 2)(最短路重建图+tarjan重边找桥)
C. Geometric ProgressionPolycarp loves geometric progressions very much. Since he was only three years old, he loves only the progressions of length three. He also has a favorite integer k and a sequen
2015-08-08 11:27:03 521
原创 2015 Multi-University Training Contest 5(hdu5343 - 5352)网络流+yy+(哈夫曼树+dp)
MZL’s xorProblem DescriptionMZL loves xor very much.Now he gets an array A.The length of A is n.He wants to know the xor of all (Ai+Aj)(1≤i,j≤n)(A_i+A_j)(1\leq i,j\leq n) The xor of an array B is defi
2015-08-06 12:00:59 857
原创 2015暑假训练赛团体赛(DLX+Trie模糊匹配+费用流)
A - Sudoku ExtensionSudoku is a logic-based, combinatorial number-placement puzzle. The objective is to fill a 9 x 9 grid so that each column, each row, and each of the nine 3 x 3 boxes (also called bl
2015-08-03 20:04:54 1522
原创 UVa 11081 - Strings(dp)
Strings 题意:给出三个字符串,用前两个字符串的子序列构造出后一个,有多少种构造方法 思路:dp[i][j][k]表示第一个字符串前i个,第二个字符串前j个,构造第三个字符串的前k个有多少种方法,刚开始只用了一个数组,怎么都不对,后来看了题解。。UVA 11081 我们用dp的思路将它分解,例如:给三个长度为len1,len2,len3的字符串,那么我们可不可以先求出长度为a,b,c,其
2015-08-02 22:01:16 390
原创 UVa 10913 - Walking on a Grid(dp递推变形)
Walking on a Grid 题意:从(1,1)走到(N,N),只能向右向左向下走,每个格子只能走一遍,并且负数格子的个数有限制,问最大能得到的值是多少 思路:因为走过的不能走,所以可以对于每一行处理一个L,R数组,分别表示该行从左往右,和从右往左到达当前格子的最大值是多少,那么对于这一行的取值肯定就是从这两个值中选个大的#include<bits/stdc++.h>using name
2015-08-02 20:59:33 393
原创 UVa 11258 - String Partition(dp)
String PartitionDescriptionJohn was absurdly busy for preparing a programming contest recently. He wanted to create a ridiculously easy problem for the contest. His problem was not only easy, but also
2015-08-02 17:17:11 424
高效awk编程
2018-06-03
hadoop-eclipse-plugin-2.7.2.jar
2016-03-19
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人