- 博客(111)
- 资源 (2)
- 收藏
- 关注
原创 tensorflow暂未兼容cuda9.0, 安装cuda8.0
旧版本cuda都在这边 https://developer.nvidia.com/cuda-toolkit-archivenvidia社区相同问题https://devtalk.nvidia.com/default/topic/1026198/cuda-9-0-importerror-libcublas-so-8-0/错误信息:ImportError: libcub
2017-11-14 20:40:32
8144
原创 cs231n assignment1 feature
图像特征提取方法 LBP在做stanford cs231n assignment1时,最后一个作业题用到了图像的特征提取, 作业里给的是HOG和color histogram这里我简单的在网上找了一下,在图像处理方面一般有三种图像特征提取方法,1)HOG 2)LBP 3)Haar因为作业里的feature.py代码写的很好,可以很容易添加不同的extra
2017-10-13 19:09:53
1551
原创 Manacher's ALGORITHM: O(n)时间求字符串的最长回文子串
leetcode problem NO.5一个很有意思的算法,马拉车算法。。。这名字2333如果说利用到了回文串的对称性质还能接受,毕竟一个回文串的性质不多,还是会想到的但是添加辅助字符操作很不一般我认为发明者Manacher肯定是先觉得对称性很有用然后千方百计想利用这一性质然后肯定会设置一些辅助数组记录各个位置的信息然后想到了“插空”我觉得他是不是之前刚好做了插空
2017-09-24 22:03:13
397
原创 5. Longest Palindromic Substring
class Solution { bool IsPalindrome(string s, int low, int high) { while(low <= high) { if(s[low] != s[high]) return false; low++; high--; }
2017-09-19 22:14:52
416
原创 4. Median of Two Sorted Arrays
参照http://blog.youkuaiyun.com/zxzxy1988/article/details/8587244double findKth(int a[], int m, int b[], int n, int k){ if (m > n) return findKth(b, n, a, m, k); else if (m == 0) retu
2017-09-18 22:59:51
459
转载 batch normalization 正向传播与反向传播 both naive and smart way
http://blog.youkuaiyun.com/xiaojiajia007/article/details/54924959Both naive and smart way to implement Backprop.
2017-09-13 17:13:29
627
原创 【2017/07】实验记录——SSSP
1. 背景接上次的报告想要利用deep learning 去预测两个点之间最短路径上的前向或者说是parent or father(当然路径可能不止一条,前向肯定也不是唯一一个,这里后面再说)因为在用一些求shortest path 算法时,都会利用保存当前点的前向最后得到路径, 或许每个点都训练一个模型,这样根据前向节点,可以把路径一步一步迭代出来。。。当然这是比较愚蠢的做法。。。不
2017-07-28 20:42:42
653
原创 ubuntu系统tmp文件夹内文件重启自动删除与恢复
ubuntu系统下tmp文件夹下文件一般默认重启自动删除当然你可以更改这些设置像我刚开始不知道,东西放里面,重启不见了。。。很抓狂。。。当然如果不小心很重要东西放里面重启消失了怎么恢复呢?这里用的是extundelete这个软件,安装直接:sudo apt-get install extundelete然后查看你tmp在哪,我的在sda7,终端输入命令:sudo ext
2017-07-23 21:35:24
8267
1
原创 【2017/7】实验记录
1、背景起因是导师和我谈到用deep learning预测traveling salesman problem问题,这是一个np-hard问题,导师的意思是或许直接去解决它可能有点困难,不如先试试其他的,然后一步一步靠近,比如dijkstra、floyed。然后就看到这篇blog:关于仓库取货这么一个问题,找到最短路径(当然实际上是找到拿完一个pick list里所有items的最
2017-07-19 13:23:58
671
原创 3. Longest Substring Without Repeating Characters
class Solution {public: int lengthOfLongestSubstring(string s) { if(s.size() == 0) return 0; if(s.size() == 1) return 1; int post[128] = {-1}; fill(post,post+128,-
2017-07-18 23:02:32
326
原创 2. Add Two Numbers
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode* ad
2017-07-18 21:44:16
240
转载 1. Two Sum
class Solution {public: vector twoSum(vector &numbers, int target) { vector ret(2,-1); unordered_map m; //value->index map for(int i = 0; i < numbers.size(); i ++)
2017-07-18 21:43:05
268
原创 numpy库中一维矩阵的一些坑点
import numpy as npw = np.array(range(15)).reshape(3,5)b = np.array(range(5))c = b.reshape(1,b.shape[0])print w.shape,b.shape, c.shape#(3, 5) (5,) (1, 5)a = w -bd = w -cprint a, a.shape"""[[
2017-07-03 18:56:56
5773
原创 【第一个爬虫】python爬取58同城企业信息并插入数据库
import urllibimport urllib2import HTMLParserfrom bs4 import BeautifulSoupimport reimport MySQLdb as mdbimport jsoni=1 #number order of companysdef GetOnePageUrl(url): global i flag = 0 req
2017-04-11 09:51:21
5223
原创 1061. Dating (20)
注意最后分钟的判定是大小字母#include#include#include#include #include#include#include #includeusing namespace std;string Day(char a){ switch(a){ case 'A':return "MON";break; case 'B':return "TUE";br
2017-02-16 14:43:40
339
原创 1060. Are They Equal (25)
考虑:1、0001.2222、0.01233、04、不足位数0补齐#include#include#include#include #include#include#include #includeusing namespace std;int n; string changes(string s){ string a; int i = 0; int
2017-02-16 13:47:35
351
原创 1058. A+B in Hogwarts (20)
#include#include#include#include #include#include#include #includeusing namespace std;int main(){ int a3,a2,a1,b3,b2,b1,s3,s2,s1; int carry; scanf("%d.%d.%d %d.%d.%d",&a3,&a2,&a1,&b3,&b2,&
2017-02-13 09:30:20
393
原创 1056. Mice and Rice (25)
感觉写的好繁琐。。。#include#include#include#include #include#include#include #includeusing namespace std;struct node{ int data; int w; int lev; int r;};vector num;queue q, p;bool comp(node a
2017-02-13 00:13:24
313
原创 1055. The World's Richest (25)
这题要剪支,每个年龄段最多输出100人,所以每个年龄最多保留100人就可以了,不然第二点超时不过我第一次用的方法第二点过了,第三点超时了。。。还多赚一分#include#include#include#include #include#include#include using namespace std;struct rec{ string name; int age
2017-02-11 15:51:24
328
原创 1053. Path of Equal Weight (30)
考查DFS算法注意点:路径要到叶子节点#include#include#include#include #include#include#include using namespace std;const int N = 101;int n, m, s;int w[N]; int sum[N];//初始化和w[N]一样 vector child[N];vector
2017-02-10 22:29:00
272
原创 1052. Linked List Sorting (25)
注意链表为空的情况,此时输出0 和 -1,最后一个点就是考查这个注意题目中这句话:NULL is represented by -1.#include#include#include#include #include#include#include using namespace std;const int N = 100010;struct node{ int add
2017-02-10 20:50:47
423
原创 1051. Pop Sequence (25)
出栈的模拟#include#include#include#include #include#include#include using namespace std;stack s;int m, n, k;int main(){ cin>>m>>n>>k; for(int i = 0; i < k; i++){ int cur = 1; bool flag =
2017-02-10 19:49:34
238
原创 1048. Find Coins (25)
#include#include#include#include #include#includeusing namespace std;vector coins;int main(){ int n, m; cin>>n>>m; for(int i = 0; i < n; i++){ int temp; scanf("%d",&temp); coins.push_
2017-02-10 01:23:51
302
原创 1047. Student List for Course (25)
#include#include#include#include #include#includeusing namespace std;const int K = 2501;vector cous[K];int main(){ int n, k; cin>>n>>k; for(int i = 0; i < n; i++){ char a1, a2, a3; int
2017-02-10 01:10:11
303
原创 1045. Favorite Color Stripe (30)
昨晚写的时候序号2的6分点没过今天终于去了趟市里,从小到大第一次,真不容易。。。回来坐车上看着窗外,想了想这题,瞬间想到了。。。说说我的思路:(以题目中例子为例)因为第二行给定颜色序列你肯定要分清先后关系,这里我就用1~m(m是给定的颜色个数)与给定的2、3、1、5、6一一映射 ,2、3、1、5、6映射 1、2、3、4、5再由1、2、3、4、5映射回2、3、1、5、6;当然估计
2017-02-09 22:14:30
303
原创 1044. Shopping in Mars (25)
双指针,辅助数组存储对应位置信息#include#include#include#include #include#includeusing namespace std;const int INF = 100000001;vector num;int main(){ int n, m; cin>>n>>m; for(int i = 0; i < n; i++){ i
2017-02-08 11:48:11
301
原创 1042. Shuffling Machine (20)
#include#include#include#include #include#includeusing namespace std;const int MAX = 54;char Front(int n){ if(n / 13 == 0){ return 'S'; } else if(n / 13 == 1){ return 'H'; } else if(n
2017-02-07 18:44:16
289
原创 1041. Be Unique (20)
#include#include#include#include #include#includeusing namespace std;const int N = 10010;int num[N] = {0}; vector all_num;int main(){ int n ; cin>>n; for(int i = 0; i < n; i++){ int tem
2017-02-06 20:57:14
316
原创 1040. Longest Symmetric String (25)
居然没超时。。。最笨的方法。。。不过字符串长度1000以内,而且判断字串是否是回文串,如果不是就跳出,这样应该不会花多少时间,字串大多数情况都是首尾直接就不相等#include#include#include#include #include#includeusing namespace std;string s;int symlen(int low, int high
2017-02-05 18:19:19
236
原创 1036. Boys vs Girls (25)
#include#include#include#include #include#includeusing namespace std;struct rec{ string name;// char gender; string id; int grade; }; vector boy, girl;bool comp(rec a, rec b){ if(a.grad
2017-02-05 17:41:26
278
原创 1037. Magic Coupon (25)
正负分开都按照负数的话可以以绝对值从大到小排序,省点事#include#include#include#include #include#includeusing namespace std;vector pcoup,ncoup,pprod,nprod;int main(){ int nc,np; cin>>nc; for(int i = 0; i < nc; i++
2017-02-05 17:22:02
282
原创 1038. Recover the Smallest Number (30)
注意除去前面零的几种情况#include#include#include#include #include#includeusing namespace std;vector s;bool comp(string a, string b){ string s1 = a + b; string s2 = b + a; if(s1 < s2) return true; else
2017-02-05 12:31:44
306
原创 1035. Password (20)
注意参数传递要引用#include#include#include#include #include#includeusing namespace std;struct rec{ string name; string pw;}; vector mod_rec;bool ismod(string &s){ bool flag = true; for(int i =
2017-02-04 22:15:20
359
原创 1034. Head of a Gang (30)
首先并查集模版要先写上,hash肯定要用设置times数组记录每个人的通话总时长,并且把所有人合并集合设置一个长度为N结构体,集合父亲对应位置存储此集合的一些信息,比如集合中所有人的通话总时长,通话最长的人,成员数遍历所有的人,把每个集合的信息存入结构体对应项为了方便下次找到所有集合的父亲,可以开一个集合(set)存储遍历出现的所有父亲遍历所有父亲,筛选所有符合条件的集合,保存
2017-02-04 21:37:18
314
原创 1085. Perfect Sequence (25)
刚开始就是排好序按照从头开始遍历,结果我用脚趾头想都超时了,果然一个三分的点超时了后来细细想想,这种类型题目,大体都是哪些方法,什么辅助数组、双指针果然这题设置大小两个动点,用辅助的数组记录每个位置对应的最大子序列元素个数#include#include#includeusing namespace std;typedef long long LL; vector s;in
2017-02-03 20:01:08
300
原创 1032. Sharing (25)
本来想的方法是根据样例第三列后继地址的重复的关系求公共节点地址,一般公共地址都会出现两次,如果没有公共节点-1也会出现两次但是好像只能过前三个测试点,不知道是不是输入节点可能包含相同节点的重复,或者一些无用节点#includeusing namespace std;int addr[100001] = {0}; int visited[100001] = {0};int main(
2017-02-02 01:01:32
463
原创 1031. Hello World for U (20)
#include#include#includeusing namespace std;int main(){ string s; cin>>s; int n = s.size(); int n1, n2; for(n1 = 1; n1 = 3 && n + 2 - 2 * n1 <= n; n1++); n1--; n2 = n + 2 - 2 * n1; for(int
2017-02-01 20:39:43
351
原创 1029. Median (25)
这题好像以前时间限制是400ms前些年的408算法题最优解好像是比较两个数组的中间值大小,然后舍去小的左边和大的右边,这样重复到最后,这样时间复杂度就是logn因为pat上有输入,所以时间复杂度至少为O(n)。。。当然可以利用排好序的条件,遍历两个数组,比较大小排序,最后输出中间值,这样时间复杂度就是O(n)#include#include #includeusing
2017-01-30 22:41:46
281
原创 1028. List Sorting (25)
#include#include#include #includeusing namespace std;struct rec{ int id; string name; int score;};int n, c;vector recs;bool comp1(rec a, rec b){ if(a.id < b.id) return true; else return
2017-01-30 21:45:49
277
原创 1027. Colors in Mars (20)
注意: 1、字符数组初始化赋值的几种方法; 2、STL中string的“ + ”操作#include#include#includeusing namespace std;char a[13] = {'0','1','2','3','4','5','6','7','8','9','A','B','C'};//char a[] = "012345
2017-01-30 21:25:19
257
chap1-high-dim-space.pdf
2020-08-17
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人