- 博客(303)
- 资源 (1)
- 收藏
- 关注
原创 Android HttpClient自动登陆discuz论坛!
你登陆论坛的时候,我们先看看浏览器干了什么事儿: 用Firefox打开HiPda 的登陆页面,输入用户名和密码,点登陆。 下面是通过firebug插件获取的数据: 可以看到浏览器这个http://www.hi-pda.com/forum/logging.php?action=login&loginsubmit=yes&inajax=1网址发了一个POST请求 看一下它POST的参数
2014-06-06 20:20:21
595
原创 UVa167 - The Sultan's Successors
题目地址:点击打开链接 就是八皇后问题 #include #include #include using namespace std; int chess[8][8],visited[3][20]; int max_sum; void dfs(int cur,int sum) { if(cur==8) { if(sum>max_sum) max_sum=sum; ret
2014-04-26 22:40:55
424
原创 UVa10012 - How Big Is It?
题目地址:点击打开链接 这个题的困难就是已经知道一组球的全排列了,怎么求包围该组球的最小的矩形的长度。 首先确定每个球圆心的位置: 要想使包围的矩形最小,球都是尽可能的与其他球接触的 如果两个球a,b接触,那么position[b]=position[a]+2*sqrt(rad[a]*rad[b]) 第i个球的圆心的位置 为max(position[j]+2*sqrt(rad[j]*r
2014-04-11 14:15:09
405
原创 UVa331 - Mapping the Swaps
题目地址:点击打开链接 就是BFS,对每一个前一个元素大于后一个元素的位置,交换这两个元素,压入队列。最后如果碰到队列中已经有排好序的元素,统计所有排好序的个数就可以了。 #include #include #include using namespace std; vector sorted_array; const int maxsize = 1000000; vector que[
2014-04-09 16:56:45
2611
原创 UVa10344 - 23 out of 5
题目地址:点击打开链接 全排列加二进制法(其实是三进制啦) #include #include using namespace std; int num[5]; bool check(int val) { int temp=num[0]; for(int i=0;i<4;++i) { int k=val%3; val/=3; switch (k) { case 0
2014-04-08 20:08:01
1468
原创 UVa301 - Transportation
题目地址:点击打开链接 就是搜索订单就可以了 #include #include using namespace std; struct Station { int start; int end; int num_of_people; }; const int maxsize = 25; Station Orders[maxsize]; int people_num_of_stati
2014-04-08 19:32:10
1246
原创 UVa539 - The Settlers of Catan
题目地址:点击打开链接 就是普通的回溯就可以了 #include #include using namespace std; int graph[30][30]; int n; int max_num; void dfs(int num,int sum) { for(int i=0;i<n;++i) { if(graph[num][i]!=0) { graph[num][
2014-04-07 17:02:07
489
原创 UVa639 - Don't Get Rooked
题目地址:点击打开链接 直接用二进制法遍历一遍就可以了 #include #include #include using namespace std; int n; string board[4]; int max_num; int visited[4][4]; bool isSafe() { for(int i=0;i<n;++i) { for(int j=0;j<n;++j)
2014-04-07 13:11:03
448
原创 UVa729 - The Hamming Distance Problem
题目地址:点击打开链接 用二进制法遍历一遍就可以了 #include #include using namespace std; int N,H; bool check(int x) { int num=0; for(int i=0;i<N;++i) { if(x&(1<<i)) ++num; } if(num==H) return true; return fa
2014-03-30 10:09:00
261
原创 UVa10098 - Generating Fast
题目地址:点击打开链接 直接运用STL的next_permutation算法,异常简单的干活思密达 #include #include #include using namespace std; int main() { int n; cin>>n; while(n--) { string s; cin>>s; sort(s.begin(),s.end()); c
2014-03-29 19:55:09
243
原创 UVa146 - ID Codes
题目地址:点击打开链接 直接运用STL的next_permutation算法就OK啦 #include #include #include using namespace std; int main() { string s; while(cin>>s&&s!="#") { if(next_permutation(s.begin(),s.end())) { cout<
2014-03-29 19:45:32
206
原创 UVa11205 - The broken pedometer
题目地址:点击打开链接 一共15盏灯,每盏灯亮或不亮,一共就2^15种可能,所有的遍历一遍就可以了。 判断两个表达方式相不相同的时候用hash的方法,空间换时间。 #include #include #include #include #include #include using namespace std; const int maxsize = 33000; int isO
2014-03-26 22:45:35
364
原创 UVa10167 - Birthday Cake
题目地址:点击打开链接 就是A,B遍历一遍就行,注意线上不能有点 #include using namespace std; const int maxsize = 110; int n; int a[maxsize][2]; int A,B; int count() { int num=0; int cnt=0; for(int i=0;i<2*n;++i) { if(A*a[
2014-03-26 20:00:52
408
原创 UVa10305 - Ordering Tasks
题目地址:点击打开链接 拓扑排序 #include #include #include #include using namespace std; const int maxsize = 110; int graph[maxsize][maxsize]; int inDegree[maxsize]; int main() { int n,m; while(cin>>n>>m&&(n
2014-03-24 22:04:34
375
原创 UVa10596 - Morning Walk
题目地址:点击打开链接 #include using namespace std; const int maxsize = 210; int f[maxsize]; int degree[maxsize]; int find_father(int x) { if(f[x]==-1||f[x]==-2) { f[x]=-1; return x; } else return f
2014-03-24 20:59:32
409
原创 UVa10054 - The Necklace
题目地址:点击打开链接 并查集,欧拉回路,欧拉回路打印 #include #include #include #include using namespace std; const int maxsize = 51; int Neck[maxsize][maxsize]; int d[maxsize]; int degree[maxsize]; vector > vpi; int n;
2014-03-24 14:30:49
333
原创 UVa10129 - Play on Words
题目地址:点击打开链接 并查集和欧拉回路 C++代码: #include #include #include using namespace std; bool flag; int d[700]; int find_father(int x) { while(d[x]!=-1) return find_father(d[x]); return x; } int main() {
2014-03-23 18:10:40
378
原创 UVa10004 - Bicoloring
题目地址:点击打开链接 就是简单的BFS就可以了 C++代码: #include #include #include using namespace std; const int maxsize = 210; int n; int graph[maxsize][maxsize]; int visieted[maxsize]; bool flag; void bfs() { visie
2014-03-23 10:13:12
436
原创 UVa10047 - The Monocycle
题目地址:点击打开链接 数组int visited[maxsize][maxsize][4][5];//4代表4个方向,5代编5中颜色,0,1,2,3代编北东南东西,Color:0,1,2,3,4 用来标记到达某个点的方向,颜色和时间。 注意输出格式! C++代码: #include #include #include #include #include using names
2014-03-22 22:06:33
350
原创 UVa10557 - XYZZY
题目地址:点击打开链接 解法: DFS,遍历到某个点,如果该点已被访问并且当前路径能量值大于已保存的该点的能量值,那么存在一个能量值和为正的环,然后判断能否从该点到达终点就可以了。 C++代码: #include #include #include using namespace std; const int maxsize = 110; int visited[maxsize];
2014-03-21 20:40:05
505
原创 UVa532 - Dungeon Master
题目地址:点击打开链接 BFS搜索六个方向即可 C++代码: #include #include #include #include #include using namespace std; const int maxsize = 40; int visited[maxsize][maxsize][maxsize]; string s[maxsize][maxsize]; int
2014-03-21 13:12:38
424
原创 UVa439 - Knight Moves
题目地址:点击打开链接 跟象棋中马一样的走法,BFS遍历 C++代码: #include #include #include #include #include using namespace std; const int maxsize = 10; int visited[maxsize][maxsize]; int num[maxsize][maxsize]; int d[8]
2014-03-20 21:35:50
382
原创 UVa784 - Maze Exploration
题目地址:点击打开链接 C++代码: #include #include using namespace std; const int maxsize =100; string grid[maxsize]; int n; void dfs(int i,int j) { if(i>=0&&i=0&&j<grid[i].size()&&grid[i][j]==' ') { grid[i
2014-03-20 13:01:33
196
原创 UVa657 - The die is cast
题目地址:点击打开链接 遍历两次就可以了 C++代码: #include #include #include #include #include using namespace std; const int maxsize = 60; string s[maxsize]; int visited[maxsize][maxsize]; int w,h; int num[maxsize
2014-03-20 12:20:38
274
原创 HDU1241-Oil Deposits
题目地址:点击打开链接 C++代码: #include #include #include using namespace std; const int maxsize = 110; string OD[maxsize]; int m,n; int visited[maxsize][maxsize]; void dfs(int a,int b) { if(a>=0&&a=0&&b<n&
2014-03-19 20:53:11
191
原创 UVa839 - Not so Mobile
题目地址:点击打开链接 注意输出格式 C++代码: #include using namespace std; bool isEqual; int build() { int W1,W2,D1,D2; cin>>W1>>D1>>W2>>D2; if(W1==0) W1=build(); if(W2==0) W2=build(); if(W1*D1!=W2*D2) is
2014-03-17 23:05:06
152
原创 UVa699 - The Falling Leaves
题目地址:点击打开链接 C++代码: #include using namespace std; bool flag=false; const int maxsize = 200; int maxNum,minNum; struct Tree { int data; Tree *lchild,*rchild; }; Tree *build()//建树 { int x; cin>>x;
2014-03-16 19:10:15
198
原创 UVa712 - S-Trees
题目地址:点击打开链接 C++代码: #include #include #include #include #include using namespace std; struct Tree { string data; Tree *left,*right; }; int main() { int n; int cas=1; while(cin>>n&&n!=0) {
2014-03-16 14:49:54
163
原创 UVa297 - Quadtrees
题目地址:点击打开链接 建树,再前序遍历就可以了 C++代码: #include #include using namespace std; struct QuaTree { char data; QuaTree *children[4]; }; QuaTree *build(string s,int &n) { QuaTree *p=new QuaTree; p->data=s
2014-03-15 21:06:28
196
原创 Deep Learning学习笔记之稀疏自编码器(Sparse Autoencoder)
首先要了解神经网络的有关知识,可以参考前一篇博文: PRML学习笔记之Neural Nerwork(神经网络) 下图是一个自编码神经网络的示意图: 目标是输入和输出保持一致,来训练神经网络,用前一篇博客中的公式。下面再总结一下: 当 时, ,也就是第 个输入值(输入值的第 个特征)。 然后: 能够得到各层的值和输出值。 对于中间层,加一个抑制参数:
2014-03-11 13:33:23
628
原创 UVa548 - Tree
题目地址:点击打开链接 C++代码: #include #include #include #include #include using namespace std; vector inOrder,postOrder; int maxNum,x,sum; struct TreeNode { int data; TreeNode *left,*right; }; TreeNode
2014-03-10 21:02:12
234
原创 UVa112 - Tree Summing
题目地址:点击打开链接 C++代码: #include #include using namespace std; bool flag; int n; int Tree_Summing(int sum) { char c; int data; cin>>c>>data; if(cin!=0) { sum+=data; int lsum=Tree_Summing(sum);
2014-03-10 09:46:19
266
原创 UVa10050 - Hartals
题目地址:点击打开链接 C++代码: #include #include #include using namespace std; int main() { int T; while(cin>>T) { while(T--) { map mii; int N,P; cin>>N>>P; int i; for(i=0;i<P;++i) {
2014-03-04 21:43:41
406
原创 PRML学习笔记之Neural Nerwork(神经网络)
1. Feed-forwardNetwork Functions 拿下图举例说明神经网络: 上图是一个三层的神经网络,第一层叫输入层,最后一层叫输出层,中间的叫做隐含层。(x0,z0是虚构的,值都是1) 数据是如何从输入层到达输出层的呢? 首先: wji叫做权重系数,wj0叫做偏移量wj0 进而: 得到第二层的值,h可能是sigmoid,tanh或soft
2014-03-04 19:42:34
780
原创 UVa540 - Team Queue
题目地址:点击打开链接 C++代码: #include #include #include #include using namespace std; const int maxsize=1010; struct LinkNode { LinkNode *left,*right; int data; }; void del(LinkNode *p) { LinkNode *l=p
2014-03-03 16:38:13
347
原创 UVa11234 - Expressions
题目地址:点击打开链接 二叉树重建+层序遍历 C++代码: #include #include #include #include #include #include using namespace std; struct TreeNode { char data; TreeNode *lchild,*rchild; }; int main() { int n; whi
2014-03-03 09:34:27
324
原创 UVa11111 - Generalized Matrioshkas
题目地址:点击打开链接 C++代码: #include #include #include #include #include #include #include #include using namespace std; int main() { int IntMin=numeric_limits::min(); string s; while(getline(cin,
2014-02-28 20:02:59
385
原创 UVa442 - Matrix Chain Multiplication
题目地址:点击打开链接 C++代码: #include #include #include using namespace std; const int maxsize = 100; int main() { int mat[maxsize][2]; int n,i,a,b; string s; cin>>n; for(i=0;i<n;++i) { cin>>s>>a>>
2014-02-25 20:27:18
317
原创 UVa673 - Parentheses Balance
题目地址:点击打开链接 C++代码: #include #include #include using namespace std; int main() { int n; cin>>n;//不用while(cin>>n) cin.get(); while(n--) { string s; stack st; getline(cin,s);//非得用getline才
2014-02-25 16:28:40
179
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人