- 博客(21)
- 收藏
- 关注
原创 【二分】Pie
题目 题目地址:Pie。思路 这题刚看到的时候依然是毫无思路,看了别人的解题报告才得知可以用二分法……妙啊。 二分的过程就是在枚举每个人可以分得的面积,计算在该面积下多少人可以得到pie。如果能得到pie的人数少于总人数,说明现在的面积太大了,调整上限;否则,则说明现在的面积还可以更小一些,调整下限。代码// 二分查找#include<iostream>#include<algorit
2017-02-26 15:31:24
394
原创 【贪心】Game Prediction
题目 题目地址:Game Prediction思路 能想到应该每次都先出大的,但是对题目中所要求的至少赢的局数的最大值一脸懵逼。 既然是至少赢的局数,那么自然其他人在能赢的时候不会放水。所以从大到小遍历所有的牌,记录其他人手中有多少张比自己大的牌;当遇到一张自己的牌时,如果其他人手中没有比自己大的牌,那么肯定赢了一局,不然其他人就把比自己大的牌中最小的那张出了。代码// 思路:每次都出最大
2017-02-25 22:07:50
854
原创 【贪心】Crossing River
题目描述 Crossing River。思路 想了半天不知道该如何用贪心解决,大概能够意识到回程中用速度快的人会使得总时间较小,但是其余部分不知如何处理。
2017-02-25 16:51:49
460
原创 【机器学习】人像分类(四)——灰度矩阵恢复成灰度图
简介 对Matlab不是非常熟悉,经过查询,了解到可以使用 colormap(flipud(gray)) 设置画出的图为灰度图(不然画出来是彩色的)。 imagesc(Matrix, []) 则用来将矩阵Matrix还原成图。
2017-02-08 19:56:11
3771
原创 【机器学习】人像识别(二)——PCA降维
降维。我用了python里sklearn.decomposition模块的IncrementalPCA。
2017-02-08 18:51:24
659
原创 【机器学习】人像分类(一)——过程总结
给定一组内容是两个人在不同光线条件、不同表情下拍摄的面部照片,将照片按照人物分成两类。这个寒假里计划要干的事情其实有很多,完成这个项目是其中之一;对CS的热门方向——如机器学习等听起来神乎其神的领域——有所了解也在ToDo-List上。据说最好的学习方式是learning in projects,不如趁此机会巩固一下python。
2017-02-08 16:52:13
1998
原创 【LeetCode】Minimum Window Substring
Minimum Window Substring Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).
2017-02-04 15:22:42
254
原创 【LeetCode】Generate Parentheses
Generate ParenthesesMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.
2017-02-03 14:49:48
379
原创 【LeetCode】Merge Two Sorted Lists
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.
2017-02-03 11:34:29
262
原创 【LeetCode】Remove Nth Node From End of List
DescriptionRemove Nth Node From End of List Given a linked list, remove the nth node from the end of list and return its head.
2017-02-03 11:24:17
275
原创 【LeetCode】Container With Most Water
DescriptionContainer With Most Water Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of lin
2017-02-03 00:00:55
229
原创 【LeetCode】3Sum Closest
Description3Sum Closet Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that ea
2017-02-02 23:55:26
222
原创 【Linux】在Linux下运行shell脚本和python文件
今天写了一个shell脚本和一个python文件试图在Ubuntu中运行,但是总是提示“没有那个文件或目录”,气氛有些尴尬。经过查询后,发现首先要经过如下处理:运行shell脚本如果shell脚本是在windows中编写的,那么需要注意windows和linux中,对换行符的编码方式不同。假设shell脚本的文件名是a.sh,那么首先需要在Vim中打开a.sh,将fileformat从dos改为u
2017-02-01 16:00:15
2833
原创 【Python】Hash+随机salt - 密码加密
Yixiaohan/show-me-the-code 第0021题Notes 这个小项目中涉及加入随机salt的哈希算法。
2017-01-30 11:49:59
2367
原创 【Python】用python对excel进行读写
Yixiaohan/show-me-the-code 第0014 ~ 0016题 && 第0020题这个小项目中涉及用python操作excel的方法。
2017-01-29 17:25:50
933
原创 【Python】生成图片验证码
DescriptionYixiaohan/show-me-the-code 第0010题这个小项目中涉及随机字符串的形成,以及PIL模块的使用。本项目中涉及到的PIL模块的一些基础操作如下:
2017-01-29 15:01:11
3013
原创 【Python】网络爬虫-批量下载图片
Yixiaohan/show-me-the-code 第0008题 && 第0009题 && 第0013题这个小项目中涉及BeautifulSoup模块的使用、文件I/O操作、从网络上下载文件等内容。
2017-01-28 17:30:00
2409
1
原创 【Python】生成随机字符串并存入MySQL数据库
Yixiaohan/show-me-the-code 第0001题 && 第0002题 这个小项目中涉及随机字符串的形成,以及用python连接MySQL的内容。
2017-01-28 16:05:37
1713
原创 【Python】为图片加上数字上标
Yixiaohan/show-me-the-code Python 练习册,每天一个小程序 第0000题 这个小项目涉及到了PIL中Image、ImageDraw还有ImageFont模块的简单使用。
2017-01-28 15:59:53
8656
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人