自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

iboxty的专栏

个人主页: https://tyliupku.github.io/

  • 博客(114)
  • 资源 (5)
  • 收藏
  • 关注

原创 tf 报错提示ValueError: setting an array element with a sequence.

stackflow解释 http://stackoverflow.com/questions/4674473/valueerror-setting-an-array-element-with-a-sequence原因是在把数据输入网络的时候列表的行数列数不匹配,比如 [[1,2], [2, [3, 4]]] [[1,2], [2, 3, 4]] 而tensor必须要2*2或者3*3的输入才行

2017-03-12 18:43:55 57308 2

原创 tensorflow index问题-1

记录一下tensorflow中的tensor index的解决方法。问题描述:对一个矩阵的不同行做max-pooling/softmax。 比如对下面的矩阵按照编号0,1,2,3 0 0 1 1

2017-02-27 21:02:49 2276

原创 poj1018 Communication System

dp简单题#include <cstdio>#include <algorithm> using namespace std;const int inf = 0x3f3f3f3f;int dp[105][1200];int main(){ int t,n,r,band,cost; scanf("%d",&t); for (int i = 0; i < t; ++i)

2016-04-07 19:38:26 473

原创 uva352 The Seasonal War-python

计算连通块,dfsMAXN = 26dirs = [[1, 0], [0, 1], [-1, 0], [0, -1], [1, 1], [1, -1], [-1, 1], [-1, -1]]cnt = 0def dfs(x, y, m, n): flag[x][y] = 1 for d in dirs: nx = x + d[0] ny = y

2016-04-05 14:09:17 983

原创 Ilya and Escalator-python

题目Ilya got tired of sports programming, left university and got a job in the subway. He was given the task to determine the escalator load factor.Let’s assume that n people stand in the queue for the e

2016-04-05 12:59:11 540

原创 NLP超级初步

书籍NLP方面:Speech and Language Processing:An Introduction to Natural Language Processing,Computational Linguistics,and Speech Recognition丛书名: 图灵原版计算机科学系列 朱拉斯凯(Daniel Jurafsky) (作者), 马丁(James H.Martin) (作

2015-08-05 16:43:09 828

原创 Android新闻类界面分享(多种布局的listview)

最近项目里需要一个新闻资讯的界面,就自己试着做了一下,还是非常简单的。实现是重写BaseAdapter,创建自己的adapter,以及popupwindow效果。效果图:下面是新闻主界面,所有的新闻条目都显示在这个页面中 Titlebar右边有一个按钮,可以选择具体门类的新闻。 点开某一条新闻直接根据url打开一个webview(这里我偷懒了,大家可以自己完善) adapter的编写从上面效果

2015-07-29 14:50:56 6198 5

转载 [about phd]读博=

读博之路并不易,它需要你专注、坚持、富有条理性以及运用科学系统的方法。芬兰于韦斯屈莱大学商业与经济学院的博士生Aijaz A. Shaikh分享了自己的一套行之有效的方法,来帮助你减压,按时完成课业,指导你争取研究资金,发表优秀的科学论文,从而为未来的职业生涯打下良好的基础。Over the last three years, I have been progressing

2015-07-27 23:48:40 1201

原创 uva 140

就是一道 DFS剪枝+枚举全排列 的题目 我用了vector来存点对的,不用考虑越界的问题。不过效率貌似不如直接用数组高。 WA了三次,花了好长时间找原因╮(╯▽╰)╭ 多么弱智的错误啊=。= WA代码#include <iostream>#include <algorithm>#include <cstdio>#include <cstdlib>#include <vector>

2015-06-02 00:26:30 634

原创 hdu 5246

注意精度。因为大于int范围,应该用LL。#include <iostream>#include <cstdio>#include <cstdlib>#include <vector>#include <algorithm>#include <cstring>using namespace std;const int maxn = 10000 + 20;long long r[maxn

2015-05-31 12:00:20 783

原创 uva 129

dfs 的题目。感觉还是比较难的。看了解题思路。 对于一个新加入的字母来说,每次判断只要保证含有这个字母的后缀子串没有重复即可。 比如说: 原先的串是:ACB 当新加入一个字母C后构成串ACBC,我们只需要看新加入的后缀C 和 他前一个字母B 是否构成重复字串;然后看一下含有两个字母的后缀 BC 和之前的 AC串是否构成重复字串。这也是dfs过程中最主要的那个循环的意思。#include <

2015-05-28 22:13:59 865

原创 uva 524

dfs 确定每一个位置上填写的数字#include <iostream>#include <cstdio>#include <cstring>#include <cstdlib>#include <math.h>using namespace std;int n;int A[18];int p[40];int vis[18];int is_prime(int n){ for(

2015-05-28 21:36:54 736

原创 uva 725

暴力法枚举,五重循环。 一开始因为空格问题WA了,要注意#include <iostream>#include <set>#include <cstdio>using namespace std;int main(){ int a,b,c,d,e,f,g,h,i,j,n; int cnt = 0; int div = 0,res; set<int> num;

2015-05-25 18:11:07 615

原创 uva 10976

枚举法 水题#include <iostream>#include <cstdio>#include <cstdlib>using namespace std;const int maxn = 1000 + 5; int main(){ int k,x,y,cnt; int xx[maxn],yy[maxn]; bool flag; while(cin >>

2015-05-25 17:57:55 739

原创 uva 12100

一道关于stl 队列的题目,比较简单。#include <iostream>#include <queue>#include <cstring>#include <cstdio>using namespace std;struct node { int seq; int pri; node(int s,int p):seq(s),pri(p){}}; queue<n

2015-05-25 12:10:34 814

原创 uva 1595

一道关于stl map的习题,并不是很复杂。 关于是否对称,我是先把所有坐标y值一样的存起来,用vector保存相应x的值。 然后遍历整个map,对于每一组y坐标一样的点,对其x值进行排序。 将x的最大值和最小值相加作为竖线的x值(的2倍),看看这条直线是否满足要求即可。#include <iostream>#include <cstdio>#include <vector>#inclu

2015-05-25 10:55:08 858

原创 uva 10391

一道关于set的水题,按输入顺序遍历就可以按照字典序输出 一开始用了二重循环结果TLE了。 后来发现可以直接一重循环搞定。TLE代码:#include <iostream>#include <cstdio>#include <cstring>#include <set>#include <vector>using namespace std;set<string> s; vector

2015-05-24 23:35:34 534

原创 uva 10763

一道关于stl map的题目,水题。 一开始WA一次因为map 没有清空另关于map,没有出现的key对应的value都是0,应该可以认为一开始初始化为0,这样就可以十分方便的进行加减操作。如下代码。 map<vector<int>,int> tt; vector<int> v;v.push_back(0); tt[v]++; cout<<tt[v]<<endl;AC

2015-05-24 23:04:32 639

原创 uva 10935

stl 队列的水题。#include <iostream>#include <cstdio>#include <queue>using namespace std;int main(){ int n; while(cin >> n && n!=0){ queue<int> q; for(int i = 1;i <=n;i++) q.push(i)

2015-05-24 20:05:02 497

原创 uva 1594

运用set判断是否重复就可以简单求解。 之前WA了一次 因为最后写了if(T) cout<<endl;//不用判断是不是最后一行,因为题目说所有结果都要独占一行AC代码:#include <iostream>#include <cstdio>#include <cstdlib>#include <vector>#include <set>#include <math.h>using

2015-05-24 12:56:45 967

原创 uva 1593

一道字符串处理的题目,用len数组记录每一列单词所占的格子数。然后使用一个vector数组保存所有的单词,依照每一列所占的大小输出。#include <iostream>#include <sstream>#include <vector>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;ve

2015-05-24 11:20:30 923

原创 uva 712

水题一道,没有用到特别的方法。 根据 000,010,111,110 这些二进制数字转化为十进制得知该查询是哪一个叶子节点的值。#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;const int maxn = 10+2;int n,m;int labe

2015-05-24 00:13:02 1131

原创 uva 673

堆栈的应用,不是很困难但一开始WA了一次,原因是没有考虑到“( ”(左括号后面有一个空格)这种情况。AC代码:#include <iostream>#include <stack>#include <cstdio>#include <cstdlib>using namespace std;int main(){ stack<char> s; int T; string

2015-05-23 18:30:48 516

原创 uva 439

BFS稍微改变了一下,走的步法不一样了。 AC代码#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <queue>#include <vector>using namespace std;const int maxn = 10;int vis[maxn][maxn];in

2015-05-23 16:38:39 616

原创 uva 536

给出二叉树先序和中序遍历打印出后序遍历结果。 这一题跟之前的 uva 548有一些类似,可以对照着学习 代码如下,特备注意dfs的时候递归条件心里要清楚,否则出错很麻烦:#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <map>#include <set>using na

2015-05-23 16:26:42 612

原创 uva 12166 bfs

这一题与白书上的一题关于天平的题目有些相似 uva839#include <iostream>#include <cstdio>#include <cstring>using namespace std;bool solve(int& w){ int w1,w2,d1,d2; cin >> w1 >> d1 >> w2 >> d2; bool b1 = true,b2

2015-05-23 14:58:54 630

原创 uva 816 BFS迷宫

这是一道比较复杂的BFS迷宫问题,状态由普通的迷宫问题的坐标(x,y)变为三个变量的状态(r,c,dir)其中dir是到达(r,c)两点的方向,这个变量非常重要,导致了这题比普通的BFS迷宫问题要更加复杂。 普通BFS解法 http://blog.csdn.net/iboxty/article/details/45888923BFS是用队列实现的,很重要并且要理解的是:每一个节点只访问一次,而且每

2015-05-21 18:30:44 1141

转载 fgets和fputs、fread和fwrite、fscanf和fprintf用法

字符串读写函数fgets和fputs一、读字符串函数fgets函数的功能是从指定的文件中读一个字符串到字符数组中,函数调用的形式为: fgets(字符数组名,n,文件指针); 其中的n是一个正整数。表示从文件中读出的字符串不超过 n-1个字符。在读入的最后一个字符后加上串结束标志”。例如:fgets(str,n,fp);的意义是从fp所指的文件中读出n-1个字符送入 字符数组str中。

2015-05-21 11:07:33 1133

原创 BFS 基础

做一道题复习一下BFS迷宫=http://hncu.acmclub.com/index.php?app=problem_title&id=111&problem_id=1102 题目描述 小明置身于一个迷宫,请你帮小明找出从起点到终点的最短路程。 小明只能向上下左右四个方向移动。 输入格式 输入包含多组测试数据。输入的第一行是一个整数T,表示有T组测试数据。 每组输入的第一行是两个整数N

2015-05-21 10:58:34 1651

原创 uva 297

四分树,递归画出四块区域#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;const int len = 32;const int maxn = 1024 + 20; int square[len][len],cnt;char s[maxn];void

2015-05-20 12:22:38 440

原创 uva 699

用一个int 变量 p 记录一下树中节点的位置,边输入就可以建树。 用flag 变量记录是否初始化。#include <iostream>#include <cstdio>#include <cstring>#include <cstdlib>using namespace std;const int maxn = 10000;int tree[maxn]; bool flag = t

2015-05-20 11:54:43 348

原创 uva 548

根据中序遍历和后序遍历构建树#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <algorithm>#include <sstream> using namespace std;const int maxv = 10000+10;int in_order[maxv],post

2015-05-20 11:18:25 725

原创 uva 572

DFS#include<iostream>#include<cstdio>#include<cstdlib>#include<cstring>using namespace std;const int maxn = 105;int idx[maxn][maxn];char input[maxn][maxn];int cnt;void dfs(int m,int n,int x,int

2015-05-18 22:24:38 383

原创 uva 1592

一开始写的是这样: 用了书上写的ID函数,然后存二元组使用的大数相乘的方法,因为看错题目BIG一开始定义为10010,错了好几次找了半天错误=.= 后来发现存二元组也可以用make_pair(x,y)#include <cstdio>#include <cstring>#include <iostream>#include <vector>#include <map>#define B

2015-05-03 14:21:13 1036

原创 uva 101

uva 老是打不开,代码没有提交成功。但应该是对的。。。 一道模拟题,用vector做的。#include <cstdio>#include <cstring>#include <iostream>#include <vector>using namespace std;const int maxn = 26;int n;vector<int> stat[maxn];void move

2015-05-01 20:41:47 366

原创 uva 253

枚举,确定哪一个面朝上之后旋转4次判断两个结果一不一样。#include <cstdio>#include <cstring>#include <iostream>#define maxn 25using namespace std;int dir[6][6] = { {1,2,3,4,5,6},{2,6,3,4,1,5},{3,2,6,1,5,4},{4,2,1,6,5,3},{5,1,3

2015-04-29 16:16:17 389

原创 uva 201

简单模拟题,在处理坐标上需要更加谨慎防止出错。#include <cstdio>#include <cstring>#include <iostream>#define maxn 15using namespace std;int H[maxn][maxn];int V[maxn][maxn];int n,m;bool issquare(int a,int b,int k){

2015-04-29 12:29:21 447

原创 uva 512

这是一道字符串处理的题目。但通过自己写的和书上写的代码对比,也是学到一些东西。 我一开始想存储一个点变换后的坐标需要两个值(x,y),再加上一个bool类型的变量判断这个点有没有被删去即可。因此写出代码如下:#include<stdio.h>#include<string.h>#define maxn 55struct point{ int ansx; int ansy;

2015-04-26 23:03:51 797

原创 uva 213

字符串处理问题 单个字符的处理,略过换行符直接读取内容。#include<stdio.h>#include<string.h>int code[8][1<<8];int readchar(){ while(1){ int ch = getchar(); if(ch!='\n'&&ch!='\r') return ch; }}int readint

2015-04-25 23:52:39 761

原创 python 安装pip、.whl格式的文件

pip是python中的一个包管理器。 包管理器就是是在电脑中自动安装、配制、卸载和升级软件包的工具组合。pip可以代替之前的easy_install,可以十分方便的引入第三方库。和linux的Ubuntu以及Debian等的apt包管理器是一样的概念。1)pip下载在这里 2)解压之后 cd到对应文件夹下安装(先安装setuptools) 3)在系统环境变量中将..\python27\Scr

2015-04-19 00:13:14 14250 2

Android新闻类界面分享(多种布局的listview)

最近项目里需要一个新闻资讯的界面,就自己试着做了一下,还是非常简单的。实现是重写BaseAdapter,创建自己的adapter,以及popupwindow效果。

2015-07-29

dlib.lib C++机器学习库

Dlib是一个机器学习的C++库,包含了许多机器学习常用的算法。而且文档和例子都非常详细,以后准备深入学习。附上比较详细的安装介绍http://blog.csdn.net/iboxty/article/details/44780341。欢迎批评指正。

2015-04-01

github开源项目SlidingMenu

相信大家对SlidingMenu都不陌生了,它是一种比较新的设置界面或配置界面的效果,在主界面左滑或者右滑出现设置界面效果,能方便的进行各种操作。很多优秀的应用都采用了这种界面方案,像facebook、人人网、everynote、Google+等等。

2014-10-25

github开源项目pulltorefresh

先讲下这啥东西,一个上拉下拉刷新的Demo

2014-10-25

Github开源项目AndroidStaggeredGrid

AndroidStaggeredGrid是etsy实现的一个android瀑布流控件,没有继承ListView和Gridview,而是从更深层的AbsListVew着手实现

2014-10-25

空空如也

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

TA关注的人

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