Python装饰器

python装饰器就是用于拓展原来函数功能的一种函数,这个函数的特殊之处在于它的返回值也是一个函数,使用python装饰器的好处就是在不用更改原函数的代码前提下给函数增加新的功能。  装饰器的基础: import time def timer(func): def deco(*args...

2018-10-24 19:01:37

阅读数:31

评论数:1

pymysql写简易的银行转账系统

import sys import pymysql class TransferMoney(object): def __init__(self,conn): self.conn=conn def check_acct_available(...

2018-09-27 10:43:29

阅读数:70

评论数:0

python与MySQL基础的交互(增删改查)

import pymysql # 打开数据库连接(ip/数据库用户名/登录密码/数据库名) db = pymysql.connect(host='localhost',user='root',password='',database='test',port=3306,charset='utf8...

2018-09-26 10:23:25

阅读数:78

评论数:0

在github上的基础操作

1.怎么在github上上传代码 https://blog.csdn.net/zhangsiyao11/article/details/77007684 https://blog.csdn.net/csjapan/article/details/79373732 2.怎么在github上删除...

2018-09-19 16:21:56

阅读数:49

评论数:0

AtCoder Grand Contest 025 B - RGB Coloring 组合数

Time limit : 2sec / Memory limit : 1024MB Score : 700 points Problem Statement Takahashi has a tower which is divided into N layers. Initially, al...

2018-08-15 16:31:06

阅读数:83

评论数:0

HDU 6395 Sequence 矩阵快速幂+分块

Let us define a sequence as below Your job is simple, for each task, you should output Fn module 109+7. Input The first line has only one integer...

2018-08-13 19:32:10

阅读数:117

评论数:0

快速读入外挂

针对n为10^5的数据有显著的作用,直接添加即可使用,输入为read.且次模板只能输入整数,对于题目中所有数据的输入都必须采用read,不然会报错。 namespace fastIO { #define BUF_SIZE 100000 //fread -> read ...

2018-08-13 19:20:12

阅读数:251

评论数:0

HDU 6386 Age of Moyu BFS+优先队列

Problem Description Mr.Quin love fishes so much and Mr.Quin’s city has a nautical system,consisiting of N ports and M shipping lines. The ports are n...

2018-08-13 18:52:51

阅读数:96

评论数:0

BZOJ 4195 程序自动分析 并查集

 Description  在实现程序自动分析的过程中,常常需要判定一些约束条件是否能被同时满足。 考虑一个约束满足问题的简化版本:假设x1,x2,x3,…代表程序中出现的变量,给定n个形如xi=xj或xi≠xj的变量相等/不等的约束条件,请判定是否可以分别为每一个变量赋予恰当的值,使得上述所有...

2018-08-07 12:20:47

阅读数:47

评论数:0

HDU 6351 Beautiful Now DFS+剪枝

Problem Description Anton has a positive integer n, however, it quite looks like a mess, so he wants to make it beautiful after k swaps of digits. L...

2018-08-07 09:38:03

阅读数:54

评论数:0

HDU 5120 Intersection 圆相交 (圆的各类模板)

Time Limit: 4000/4000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others) Total Submission(s): 1791    Accepted Submission(s): 686   Pro...

2018-08-07 09:11:59

阅读数:65

评论数:0

HDU 6354 Everything Has Changed 圆相交 模板水题

Problem Description Edward is a worker for Aluminum Cyclic Machinery. His work is operating mechanical arms to cut out designed models. Here is a br...

2018-08-07 09:06:08

阅读数:55

评论数:0

POJ - 1456 Supermarket 贪心+并查集 /小根堆

  A supermarket has a set Prod of products on sale. It earns a profit px for each product x∈Prod sold by a deadline dx that is measured as an integr...

2018-08-02 15:40:51

阅读数:44

评论数:0

POJ 3190 -Stall Reservations 小根堆 贪心 区间问题

Oh those picky N (1 <= N <= 50,000) cows! They are so picky that each one will only be milked over some precise time interval A...

2018-08-02 15:15:59

阅读数:37

评论数:0

HDU 6324 Grab The Tree 异或

Problem Description Little Q and Little T are playing a game on a tree. There are n vertices on the tree, labeled by 1,2,...,n, connected by n−1 bidi...

2018-08-01 21:00:11

阅读数:70

评论数:0

HDU 6343 Graph Theory Homework

Problem Description There is a complete graph containing n vertices, the weight of the i-th vertex is wi. The length of edge between vertex i and j (...

2018-08-01 20:31:02

阅读数:155

评论数:0

HDU 6335 Nothing is Impossible 贪心

Problem Description m students, including Kazari, will take an exam tomorrow. The paper consists of exactly n problems, the i-th problem contains ai ...

2018-08-01 20:24:36

阅读数:132

评论数:0

HDU 6342 Expression in Memories 表达式填充

Kazari remembered that she had an expression s0 before. Definition of expression is given below in Backus–Naur form. <expression&g...

2018-08-01 20:19:18

阅读数:55

评论数:0

POJ - 3764 The xor-longest Path 字典树+异或

题意:给定一棵N个节点的树,树上的每条边都有一个权值,从树中选择两个点x和y,把从x到y路径上的所有边权xor异或起来,得到的最大结果是多少。 思路:相同部分异或为0,所以从x到y路径上的边权的xor结果为D[x] xor D [y] ,将x到根与y到根的重叠部分恰好抵消掉。...

2018-07-31 15:51:09

阅读数:41

评论数:0

CH 1602 The XOR Largest Pair 字典树+异或

描述 在给定的N个整数A1,A2……AN中选出两个进行xor运算,得到的结果最大是多少? 输入格式 第一行一个整数N,第二行N个整数A1~AN。 输出格式 一个整数表示答案。 样例输入 3 1 2 3 样例输出 3 数据范围与约定 对于100%的数据: N<=10^5,...

2018-07-31 15:44:31

阅读数:157

评论数:0

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