自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(216)
  • 资源 (7)
  • 收藏
  • 关注

原创 python 牛客 Fibonacci数列

n=int(input())f1=0f2=1while f2<n: f1,f2=f2,f1+f2print(min(f2-n,n-f1))

2018-12-31 20:25:13 472

原创 python 牛客 小易喜欢的单词

这里可以用正则匹配这样的骚方法s=input()import repattern1 = re.compile(r"[^A-Z]+")pattern2 = re.compile(r"([A-Z])\1")pattern3 = re.compile(r"([A-Z])[A-Z]*([A-Z])[A-Z]*\1[A-Z]*\2")if pattern1.search(s) or patter...

2018-12-31 20:05:51 431

原创 python 牛客 两种排序方法

n=int(input())list1=[]i=0curl=1f1=Truewhile i<n: s1=input() if f1: if len(s1)<curl: f1=False curl=len(s1) list1.append(s1) i+=1f2=Truefor i in ...

2018-12-31 19:33:34 306

原创 python 牛客 饥饿的小易

数学题 1.fg=gf 2.fff=ggstart=int(input())count1=0count2=1count3=2m=1000000007start1=start%mstart2=(4*start1+3)%mstart3=(4*start2+3)%mwhile count1<100000 and start1!=0: start1=(8*start1+7)...

2018-12-31 18:12:42 206

原创 python 牛客真题 统计回文

s=input()t=input()def judge(s): ls=len(s) for i in range(ls//2): if s[i] != s[ls-1-i]: return False return True cnt=0for i in range(len(s)+1): if judge(s[:i]+t...

2018-12-31 17:32:21 286

原创 python 牛客真题 解救小易

n=int(input())x=list(map(int,input().split()))y=list(map(int,input().split()))mymin=float('inf')for i in range(n): mymin=min(mymin,x[i]+y[i]-2)print(mymin)

2018-12-31 16:51:24 244

原创 python 牛客真题 不要二

num=input().split()n=int(num[0])m=int(num[1])if m%4==2: m,n=n,mtmp1=(m+1)//2tmp2=m-tmp1mysum=0for i in range(n): if i%4==0 or i%4==1: mysum+=tmp1 else: mysum+=tmp2p...

2018-12-31 16:43:11 268

原创 python 牛客真题 幸运的袋子

DFS,需要剪枝n=int(input())num=list(map(int,input().split()))num.sort()def dfs(num,mysum,mymul): count=0 for i in range(len(num)): if i>0 and num[i]==num[i-1]: continue ...

2018-12-31 16:05:41 256

原创 python 牛客真题 混合原料

一道很赞的题目。遵循这样一个最基本的思路,最大的数肯定不能通过异或生成,所以必须要取。遵循这个思路:除了这个最大的数其他所有与其位数相同的数都可以通过异或生成。再看异或这个操作本身的特殊性(不同为1,相同为0)即意味着如果最大的数的位数为4,那么肯定要取到位数为3的最大数。n=int(input())num=[int(c) for c in list(input().split())]def...

2018-12-31 13:53:56 219

原创 python 牛客真题 数列还原

考察全排列?nk=list(input().split())n=int(nk[0])k=int(nk[1])num=[int(c) for c in list(input().split())]m=[0]*(n+1)index=[]for i in range(n): if num[i]==0: index.append(i) else: m[num[i]]=1a=...

2018-12-30 18:47:30 213

原创 python 牛客真题 藏宝图

s=input()t=input()l1=len(s)l2=len(t)i,j=0,0while i<l1 and j<l2: if s[i]==t[j]: i+=1 j+=1 else: i+=1if j==l2: print('Yes')else: print('No')

2018-12-30 16:14:09 253

原创 python 牛客真题 星际穿越

num=int(input())import mathprint(int((math.sqrt(1+4*num)-1)/2))

2018-12-30 16:05:01 318

原创 python 牛客真题 分苹果

改成 只能往相邻移动的话难度会增加n=int(input())num=[int(c) for c in input().split()]if sum(num)%n !=0: print(-1)else: target=sum(num)//n flag =0 if target%2==0 else 1 count=0 for n in nu...

2018-12-30 15:58:30 486

原创 python 牛客真题 分田地

二分贪心查找nm=list(input().split())n=int(nm[0])m=int(nm[1])board=[[0]*m for _ in range(n)]count=0while count<n: num=input() for j in range(m): board[count][j]=int(num[j]) count...

2018-12-30 15:56:08 322

原创 python 牛客真题 下厨房

count=0s=''try: while True: s=s+input()+' 'except: passprint(len(set(s.split())))

2018-12-30 15:49:18 165

原创 python 牛客真题 合唱团

n=int(input())performance=list(input().split())kd=list(input().split())k=int(kd[0])d=int(kd[1])dp=[[0]*n for _ in range(k)]dp1=[[0]*n for _ in range(k)]for j in range(n): performance[j]=int...

2018-12-30 15:48:24 516

原创 410. Split Array Largest Sum

left是数组中的最大值,right是数组和。通过canSplit来改变left和right(此时的他们的桥梁是平均值),最终他们会收敛到一个值。class Solution: def splitArray(self, nums, m): """ :type nums: List[int] :type m: int :rty...

2018-12-29 20:40:41 214

原创 kaggle tensorflow 泰坦尼克 逻辑回归

import pandas as pdimport numpy as npimport tensorflow as tf from sklearn import preprocessingfrom tensorflow.contrib.tensor_forest.python import tensor_forestfrom tensorflow.python.ops import re...

2018-12-29 15:02:32 230

原创 kaggle上泰坦尼克的年龄使用tensorflow进行随机森林回归

kaggle上泰坦尼克的年龄使用随机森林分类为什么准确率只有0.47import pandas as pdimport numpy as npimport tensorflow as tf from tensorflow.contrib.tensor_forest.python import tensor_forestfrom tensorflow.python.ops import ...

2018-12-28 15:23:22 1120 2

原创 从零开始 TensorFlow RandomForest

tf.reset_default_graph() 注意要重新设置一下图from __future__ import print_functionimport tensorflow as tffrom tensorflow.contrib.tensor_forest.python import tensor_forestfrom tensorflow.python.ops import r...

2018-12-28 14:04:43 564

原创 python 字节跳动 [编程题] 用户喜好

第一次做这种自己要读取输入的题 泪崩!本来能十几分钟做完的题目,结果用了一小时import bisectnum=int(input())l1=list(input().split())dict1={}for i in range(num): c=l1[i] if c in dict1: dict1[c].append(i+1) else: ...

2018-12-26 21:14:06 1280

原创 TensorFlow Word2vec

Word2vec 之 Skip-Gram 模型from __future__ import division, print_function, absolute_importimport collectionsimport osimport randomimport urllib.requestimport zipfileimport numpy as npimport ten...

2018-12-25 13:09:39 285

原创 TensorFlow kmeans

tf.nn.embedding_lookup:tf.nn.embedding_lookup()就是根据input_ids中的id,寻找embeddings中的第id行。比如input_ids=[1,3,5],则找出embeddings中第1,3,5行,组成一个tensor返回。num_steps=500batch_size=1024k=25num_classes=10num_featu...

2018-12-24 11:03:09 421 1

原创 TensorFlow softmax回归

tf.cast 是转换类型from __future__ import print_functionimport tensorflow as tfimport numpy as npimport matplotlib.pyplot as pltfrom tensorflow.examples.tutorials.mnist import input_datamnist=input_da...

2018-12-23 20:39:06 200

原创 TensorFlow线性回归

from __future__ import print_functionimport tensorflow as tfimport numpy as npimport matplotlib.pyplot as pltnr=np.randomlearning_rate = 0.01training_epochs=1000display_step=50train_X = np.a...

2018-12-23 17:05:06 109

原创 TensorFlow NN

from __future__ import print_functionimport numpy as npimport tensorflow as tffrom tensorflow.examples.tutorials.mnist import input_datamnist=input_data.read_data_sets("/tmp/data/",one_hot=True)...

2018-12-23 15:59:40 198

原创 从零开始 TensorFlow session进行符号运算

from __function__ import print_function import tensorflow as tf a=tf.constant(2)b=tf.constant(3)with tf.Session() as sess: print('sess run ... a+b result: %i' % sess.run(a+b)) print('sess run .....

2018-12-22 18:56:20 191

原创 从零开始 TensorFlow 立即进行符号运算

from __future__ import absolute_import, division, print_functionimport numpy as npimport tensorflow as tfimport tensorflow.contrib.eager as tfetfe.enable_eager_execution()a = tf.constant(2)pr...

2018-12-22 17:52:16 264

原创 从零开始 TensorFlow helloword

from __future__ import print_functionimport tensorflow as tfhello = tf.constant('hello, tensorflow')sess = tf.Session()print(sess.run(hello))

2018-12-22 16:34:19 139

原创 python爬虫 携程上海

年关将至,不想磕盐。正好有个美丽的小仙女要来上海玩。闲来无事,先用爬虫踩踩点。毕竟人懒,不想实地考察。先看游记,注意到网页链接为http://you.ctrip.com/travels/shanghai2.html 我就很好奇第一页就是shanghai2???那shanghai1 是啥。怀着好奇的心情点进去一看,http://you.ctrip.com/travels/shanghai1.ht...

2018-12-21 14:10:47 2107 1

原创 python leetcode 290. Word Pattern

class Solution: def wordPattern(self, pattern, str): """ :type pattern: str :type str: str :rtype: bool """ list1=str.split(" ") if len(lis...

2018-12-20 19:49:03 201

原创 python leetcode 289. Game of Life

class Solution(object): def gameOfLife(self, board): """ :type board: List[List[int]] :rtype: void Do not return anything, modify board in-place instead. """ ...

2018-12-20 19:43:29 186

原创 python leetcode 287. Find the Duplicate Number

class Solution: def findDuplicate(self, nums): """ :type nums: List[int] :rtype: int """ for i in range(len(nums)): index = abs(nums[i])-1 ...

2018-12-20 19:42:06 234

原创 python leetcode 284. Peeking Iterator

class PeekingIterator: def __init__(self, iterator): """ Initialize your data structure here. :type iterator: Iterator """ self.iterat=iterator self...

2018-12-20 19:40:02 177

原创 python leetcode 283. Move Zeroes

class Solution(object): def moveZeroes(self, nums): """ :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ i=0 ...

2018-12-20 19:38:41 112

原创 python leetcode 227. Basic Calculator II

class Solution(object): def calculate(self, s): """ :type s: str :rtype: int """ def helper(op, val): if op == '+': stack.append...

2018-12-20 19:35:53 192

原创 python leetcode 279. Perfect Squares

四平方和定理class Solution(object): def numSquares(self, n): """ :type n: int :rtype: int """ import math while n%4==0: n=n//4 if n %...

2018-12-20 14:55:56 297

原创 python leetcode 275. H-Index II

class Solution: def hIndex(self, citations): """ :type citations: List[int] :rtype: int """ n = len(citations) l,r=0,n-1 h = 0 whil...

2018-12-20 14:54:02 148

原创 python leetcode 274. H-Index

class Solution: def hIndex(self, citations): """ :type citations: List[int] :rtype: int """ citations.sort() n = len(citations) l=0 ...

2018-12-20 14:52:52 217

原创 python leetcode 268. Missing Number

class Solution: def missingNumber(self, nums): """ :type nums: List[int] :rtype: int """ n=len(nums) if n==0: return 0 i=0 ...

2018-12-19 19:10:10 140

七夕表白8个网页源代码合集.zip

一共8个网页,超大合集近60M。 七夕表白8个网页源代码合集.zip

2019-08-07

Modern PHP++++++.pdf.zip

Modern+PHP(中文版).rar Modern+PHP的中文翻译版。属于进阶书籍

2019-08-06

laravel框架.ppt

此PPT讲述了Laravel框架的设计概念并对其他的框架做了一个简单的对比。 一共33页PPT

2019-08-06

七夕表白html+css合集.zip

五款七夕表白html+css合集,大声说出你的故事。专属于程序员的浪漫

2019-08-06

NLP汉语自然语言处理原理与实践_郑捷(著)_.pdf

NLP汉语自然语言处理原理与实践_郑捷(著) 非常不错的学习资料

2019-04-21

PYTHON QT GUI快速编程 PYQT编程指南

PYTHON QT GUI快速编程 PYQT编程指南 适合入门python简单的界面设计

2018-12-06

空空如也

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

TA关注的人

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