py-笔试&学习笔记
vicky428
这个作者很懒,什么都没留下…
展开
-
tx.py-20180916
#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Created on Sun Sep 16 15:33:06 2018@author: vicky"""for line in sys.stdin: a = line.split()a=[2,3,3]k=0for x in range(1,a[0]+1): f...原创 2019-07-24 12:45:04 · 120 阅读 · 0 评论 -
quickpaixu.py-20180402
#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Created on Mon Mar 26 21:29:35 2018@author: vicky"""#快速排序#先从待排序的数组中找出一个数作为基准数(取第一个数即可),#然后将原来的数组划分成两部分:小于基准数的左子数组和大于等于基准数的右子数组。#然后对这两个子数组再递归重...原创 2019-07-18 12:09:25 · 65 阅读 · 0 评论 -
net.py-20180328
#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Created on Tue Mar 27 19:41:48 2018@author: vicky"""def shell_sort(list): n = len(list) gap = 5 #初始步长 while gap > 0: ...原创 2019-07-18 12:08:31 · 81 阅读 · 0 评论 -
cramler.py-20171128
#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Created on Sat Sep 2 16:45:17 2017@author: vicky"""#import scrapy##class DmozItem(scrapy.Item):# title = scrapy.Field()# link = scrap...原创 2019-07-18 12:09:08 · 103 阅读 · 0 评论 -
kickstart.py-20171022
kickstart_gb.py#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Created on Sun Oct 22 13:50:39 2017@author: vicky"""import numpy as np import mathdata=np.array(data2[1:300],dtype=int)r=...原创 2019-07-18 12:08:10 · 102 阅读 · 0 评论 -
svm.py-20171018
#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Created on Wed Oct 18 17:20:19 2017@author: vicky"""'''SVC参数解释 (1)C: 目标函数的惩罚系数C,用来平衡分类间隔margin和错分样本的,default C = 1.0; (2)kernel:参数选择有RBF, Li...原创 2019-07-17 12:20:49 · 122 阅读 · 0 评论 -
logit.py-2017108
#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Created on Wed Oct 18 16:37:12 2017@author: vicky"""import numpy as npy from sklearn import linear_model, datasets from sklearn.cross_valid...原创 2019-07-17 12:20:42 · 72 阅读 · 0 评论 -
address2.py-20170905
#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Created on Sun Sep 3 19:52:45 2017@author: vicky"""class simhash: #构造函数 def __init__(t, tokens='', hashbits=n): ...原创 2019-07-16 18:28:39 · 88 阅读 · 0 评论 -
address.py-20170903
#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Created on Sun Sep 3 16:35:27 2017@author: vicky"""#!/usr/bin/python # coding=utf-8 class simhash: #构造函数 def __init__(se...原创 2019-07-16 18:29:18 · 172 阅读 · 0 评论 -
microsoft.py-20180402
#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Created on Mon Apr 2 19:22:36 2018@author: vicky"""def f(g,s): l=[i for i in range(g)] k=0 while len(l)>1: k=k+s ...原创 2019-07-18 12:09:31 · 78 阅读 · 0 评论 -
huawei.py-20180413
#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Created on Tue Apr 3 19:25:43 2018@author: vicky"""def manacher(s): #预处理 s='#'+'#'.join(s)+'#' RL=[0]*len(s) MaxRight=0 p...原创 2019-07-22 19:45:34 · 94 阅读 · 0 评论 -
pysparkexample.py-20180713
# -*- coding: utf-8 -*-"""Created on Fri Jul 13 10:03:33 2018@author: wenyun.wxw"""#http://help.aliyun-inc.com/internaldoc/detail/49805.html?spm=a2c1f.8259796.2.243.dwy2KNfrom odps.odps_sdk im...原创 2019-07-23 12:50:03 · 198 阅读 · 0 评论 -
zhaohang.py
#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Created on Sun Apr 22 20:35:57 2018@author: vicky"""t=input()for i in range(2): n=int(input()) v=[int(i) for i in input().split()] ...原创 2019-07-22 19:46:18 · 65 阅读 · 0 评论 -
bubble.py-20180418
#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Created on Sun Mar 25 15:18:43 2018@author: vicky"""#冒泡def bubbleSort(l): for i in range(len(l)): for j in range(1, len(l) - i): ...原创 2019-07-22 19:46:13 · 95 阅读 · 0 评论 -
souhu.py-20180414
#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Created on Sat Apr 14 17:03:23 2018@author: vicky"""#n=int(input())#l=[]#for i in range(n):# l=l+[int(n) for n in input().split()]#b=0#...原创 2019-07-22 19:46:02 · 80 阅读 · 0 评论 -
oj.py-20180414
#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Created on Mon Apr 9 21:30:01 2018@author: vicky"""#例1:a+b#输入#1 5#2 3#输出#6#3import sys for line in sys.stdin: #循环读每行 a = line.split...原创 2019-07-22 19:45:56 · 383 阅读 · 0 评论 -
oj2.py-20180414
#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Created on Tue Apr 10 12:10:12 2018@author: vicky"""#input():遇到输入enter停止输入,返回。返回的结果不包含末尾的换行符'\n'#sys.stdin.read():读取数据 ctrl+d是结束输入 ,enter是换行。故...原创 2019-07-22 19:45:52 · 82 阅读 · 0 评论 -
mapreducer.py-20180412
#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Created on Wed Apr 11 22:37:38 2018@author: vicky"""from itertools import groupbyfrom operator import itemgetterthings = [('2009-09-02', 11)...原创 2019-07-22 19:45:39 · 69 阅读 · 0 评论 -
reducer.py mapper.py -20180411
#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Created on Wed Apr 11 22:36:56 2018@author: vicky"""from operator import itemgetterfrom itertools import groupbyimport sysdef read_mapper_o...原创 2019-07-22 19:45:46 · 226 阅读 · 0 评论 -
cramler2.py-20171207
#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Created on Tue Nov 21 21:18:48 2017@author: vicky"""#cramler1的改写# 实现一个简单的爬虫,爬取百度贴吧图片# 1. urllib+re实现import urllib.requestimport re#网址ur...原创 2019-07-18 12:09:19 · 89 阅读 · 0 评论