2014WAP校园招聘笔试题

Works Application面试总结 2015年秋Works Application面试总结 阅读详情

这是2014年WAP笔试的第一题,当时没有做出了,最近在网上看到一篇博客写了关于这道题的解法,自己看了看用C++实现了。博客地址:http://blog.youkuaiyun.com/litoupu/article/details/41220817

题目:

Abstract
We are planning an orienteering game.
The aim of this game is to arrive at the goal (G) from the start (S) with the shortest distance.
However, the players have to pass all the checkpoints (@) on the map.
An orienteering map is to be given in the following format.
########
#@....G#
##.##@##
#..@..S#
#@.....#
########
In this problem, an orienteering map is to be given.
Calculate the minimum distance from the start to the goal with passing all the checkpoints.
Specification
* A map consists of 5 characters as following.
You can assume that the map does not contain any invalid characters and
the map has exactly one start symbol 'S' and exactly one goal symbol 'G'.
* 'S' means the orienteering start.
* 'G' means the orienteering goal.
* '@' means an orienteering checkpoint.
* '.' means an opened-block that players can pass.
* '#' means a closed-block that players cannot pass.
* It is allowed to move only by one step vertically or horizontally (up, down, left, or right) to the
next block.
Other types of movements, such as moving diagonally (left up, right up, left down and right down)
and skipping one or more blocks, are NOT permitted.
* You MUST NOT get out of the map.
* Distance is to be defined as the number of movements to the different blocks.
* You CAN pass opened-blocks, checkpoints, the start, and the goal more than once if necessary.
* You can assume that parameters satisfy following conditions.
* 1 <= width <= 100
* 1 <= height <= 100
* The maximum number of checkpoints is 18.
* Return -1 if given arguments do not satisfy specifications, or players cannot arrive at the goal

from the start by passing all the checkpoints.



解题思路:

本题是一道动态规划问题,问题的难点在于如何存储中间子问题的结果,比如这道题是求从起点S经过所有的@到达终点G求其最短路径,以题目中的例子为例:S编号为0, G编号为5,其他@节点从上到下从左到右依次编号为1,2,3,4,我们求到达G的最短路径我们可以分解为是从1到达还是从2,3,4到达G这样就转换成求解到达1,2,3,4四个较小的子问题,依次类推把问题不断缩小。这里有一个问题就是到达某个checkpoints  i 不是仅仅的求其从起点S到达此i的最短路径而是要经过除其后路径上的@的节点所有@节点,比如我们是从4到达G的但是从S到达4有好多种方法如S-1-2-3,S-1-3-2,S-2-1-3...等等他们又可以分为许多更小的子问题,为了不重复计算需要把这些中间结果都存储下来,这么在以后的计算中快速判断和找到这个子问题是否已经计算过了呢?参考的博客中使用 位 很好的解决了这个问题,比如本例中有四个checkpoints那么我们就用四位二进制来表示:XXXX,(X取0或1)分别代表第四个第二个第三个第一个checkpoint,0101表示到达指定的节点需要经过第三个和第一个节点,1001表示到达指定节点需要经过第一个和第四个节点。以下代码中slove(G,1111)表示从起点S经过四个chekpoints到达G的最短路径。

代码:


#include <iostream>
#include <algorithm>
#include <queue>
#include <cstring>
#include <cmath>

using namespace std;

const int MAX_VAL = 1000000000;//不可达 
//到达目的的路径个数的上限值 ,这个值取多大取决于从S经过所有的@到达G有多少条不同的路径(全排列)
const int LEN = 524288; 
const int dir[4][2] = {{0,1},{0,-1},{1,0},{-1,0}};//搜索的四个方向 

struct node
{
	int r;
	int c;
	int step;
};

char ori_map[102][102];//地图 
unsigned int index[102][102];//给起点S,终点G以及每一个checkpoints节点分配一个索引0,1,2.... 
bool isVisited[102][102];//记录是否走过这个节点 
int width, height;
int checkpoints = 0;//记录checkpoints个数 
int S_R, S_C, G_R, G_C;//起点和终点的行列坐标 

int minDistance[20][20];//任意S,G或@节点之间的最小距离
//state[i][j]中j转化为二进制表示每一位代表一个checkpoint节点,
//若是1就代表到达i节点必须要走这个节点 ,比如j = 0101b就表示到达i要经过第一个和第三个checkpoint 
int state[20][LEN];

void bfs(node start)
{
	memset(isVisited, false, sizeof(isVisited));
	queue<node> q;
	q.push(start);
	
	while(!q.empty())
	{
		node first = q.front();
		q.pop();
		int r = first.r;
		int c = first.c;
		int step = first.step;
		isVisited[r][c] = true;
		for(int i=0;i<4; ++i)
		{
			int nextr = r + dir[i][0];
			int nextc = c + dir[i][1];
			if(nextr>=0&&nextr<height
			   &&nextc>=0&&nextc<width
			   &&isVisited[nextr][nextc]==false
			   &&ori_map[nextr][nextc]!='#')
			{
				isVisited[nextr][nextc] = true;
				node tmp;
				tmp.r = nextr;
				tmp.c = nextc;
				tmp.step = step + 1;
				q.push(tmp);
				//if('S'==ori_map[nextr][nextc]||'G'==ori_map[nextr][nextc]||'@'==ori_map[nextr][nextc])
				if('.'!=ori_map[nextr][nextc])
				{
					minDistance[index[start.r][start.c]][index[nextr][nextc]] = step + 1;
				}
			}
		}
	}
}

void getminDistance()
{
	for(int i=0; i<height; ++i)
	{
		for(int j=0; j<width; ++j)
		{
			if('S'==ori_map[i][j] || 'G'==ori_map[i][j] || '@'==ori_map[i][j])
			{
				node tmp;
				tmp.r = i;
				tmp.c = j;
				tmp.step = 0;
				bfs(tmp);
			}
		}
	}
}

int slove(int k, int s)
{
	if(state[k][s]>0&&state[k][s]<MAX_VAL)
	{
		return state[k][s];
	}
	int ans = MAX_VAL;
	for(int i=1; i<checkpoints+2; ++i)
	{
		if((s & (1<<(i-1)))!=0)
		{
			int subSlove = slove(i, s^(1<<(i-1)));
			if(subSlove!=MAX_VAL && minDistance[i][k]!=MAX_VAL)
			{
				int subAns = subSlove + minDistance[i][k];
				if(subAns<ans)
				{
					ans = subAns;
				}
			}
		}
	}
	
	state[k][s] = ans;
	return ans;
}

int main()
{
	cin>>width>>height;
	for(int i=0;i<height;i++)
	{
		for(int j=0;j<width;++j)
		{
			cin>>ori_map[i][j];
			switch(ori_map[i][j])
			{
				case 'S':
					S_R = i;
					S_C = j;
					index[i][j] = 0;
					break;
				case 'G':
					G_R = i;
					G_C = j;
					break;
				case '@':
					++checkpoints;
					index[i][j] = checkpoints;
					break;
			}
		}
	}
	
	index[G_R][G_C] = checkpoints+1;
	
	for(int i=0; i<checkpoints+1; ++i)
	{
		minDistance[i][i] = 0;
		for(int j=i+1; j<checkpoints+2; ++j)
		{
			minDistance[i][j] = MAX_VAL;
			minDistance[j][i] = MAX_VAL;
		}
	}
	
	getminDistance();
	
	for(int i=1; i<checkpoints+2; ++i)
	{
		state[i][0] = minDistance[i][0];
	}
	
	int end_state = (1<<checkpoints) - 1;;
	int len = slove(checkpoints+1, end_state);
	
	if(MAX_VAL == len)
	{
		cout << -1 << endl;
	}
	else
	{
		cout << len << endl;
	}
	
	return 0;
}

为题目中的例子附加张图来帮助理解代码中slove的递归操作吧:


OpenCV图像分割cv::grabCut()函数 函数:void grabCut( InputArray img, InputOutputArray mask, Rect rect,                            InputOutputArray bgdModel, InputOutputArray fgdModel,                            int iterCount, int mo 阅读详情

相关推荐

windows程序设计中MM_TEXT模式下的逻辑坐标与设备坐标的转换

在windows程序设计中,MM_TEXT模式下逻辑坐标和设备坐标原点默认是(0 , 0) ,在客户区左上角。x轴从左到右增加,y轴从上到下增加。当使用SetViewportOrgEx() 和 SetWinodwOrgEX()函数修改设备坐标系和窗口(逻辑)坐标系时,我们该怎么简单的找到逻辑坐标系点(0 , 0 )在变换后的位置,一种简单的方法是移动逻辑坐标系原点去和设备坐标系原点重合(注意:不管

知行且执行 2708

WAP2017春招笔试题

笔者非计算机专业,小白一枚,博客记录一下日常做的算法题,未参加WAP笔试,题目由群友提供。 思路: 使用动态规划+map 以下是代码: #include #include #include #include using namespace std; class solution{ public: bool pre_exist(int max_left,int

chaoji81的博客 1541

WAP 2013年笔试题(区间相关)

本资源是WAP公司2013年的笔试题,涉及的题目是关于区间调度的。

WAP校招笔试

Abstract We are planning an orienteering game. The aim of this game is to arrive at the goal (G) from the start (S) with the shortest distance. However, the players have to pass all the checkpoints

u013268685的专栏(有一种幸福叫AC,有一种期待叫AK) 3027

PDF批量加水印 与 去除水印实践

我们可以给PDF加图片水印或文字水印,要去除图片水印,一般只需要删除最后一个图片对象即可。要去除文字水印,需要保证主体内容和文字水印在/Contents中位于不同的对象内,这样我们只需要删除文字水印对应的对象即可删除水印。而对于主体内容和文字水印已经混合在一个对象时,本文的提供的方法则无能为力,需要进一步深入分析PDF细节。

小小明-代码实体的专栏 2763

2017阿里内推笔试题--算法工程师(运筹优化)

2017阿里内推笔试题–算法工程师(运筹优化)题目沐哲是一个菜鸟仓库的一个拣货员,但他有非常个怪异的习惯。每次拣货的重量都要比之前拣的一个轻,每次拣到货后都可以得到1块钱,沐哲想知道这样最多能赚多少钱 32 34 7 33 21 2 13 12 3 11 26 36 16 30 22 1 24 14 20 23 25 5 19 29 27 15 9 17 31 4 6 18 8 10 3

shawpan的专栏 1万+

2019WAP初试笔试题目

初试一共两道题目,做答时间2小时 第一题:给定n个公交站,m条线路,假设每条线路坐车的价格均是1元,求从站点1到站点n所花的最少钱。(保证站点1到站点n一定有路径) 每条线路均是1元,求最小花费,本质上就是求公交线路最少换乘数+1。 输入:       第一行:n,m       第二行-第m+1行 线路站点数,线路从第一个站点到最后一个站点 输出:       最少的花费 案例输...

aoxue_bai的博客 729

【硬件开源实战】STM32G070RBT6开发板从设计到避坑全解析

本文全面解析了STM32G070RBT6开发板从硬件设计到避坑的实战经验。详细介绍了电源设计、时钟电路、PCB布局等关键环节,分享了成本控制、焊接测试、软件开发和外设驱动的实用技巧,帮助开发者高效完成项目开发。

weixin_26897585的博客 243

WAP笔试题

Wireless Routers WAP exam

jlin991的博客 1307

激光甲烷传感器DIY指南:从DFB激光器选型到Herriott池光路搭建

本文详细介绍了如何DIY激光甲烷传感器,从DFB激光器选型到Herriott池光路搭建的全过程。通过TDLAS技术实现ppm级甲烷检测,适用于家用燃气泄漏监测和农业沼气监测等场景。文章包含核心器件选型、光路搭建技巧、信号调理方案及系统集成优化,为创客提供实用指南。

f9g0h的博客 597

Ubuntu22.04实战:基于VLLM高效部署Qwen3系列模型并构建Dify智能体

本文详细介绍了在Ubuntu22.04系统上使用VLLM高效部署Qwen3系列模型并集成Dify平台的实战指南。从环境配置、Conda管理到VLLM优化部署,再到Dify智能体构建,提供了全面的技术方案和性能调优建议,帮助开发者快速实现AI模型的高效部署与应用。

weixin_28323057的博客 163

2014 WAP校园招聘笔试题

 2014 WAP校园招聘笔试题 Problem's Link:   http://www.doc88.com/p-6751117015483.html   WAP公司笔试题 We are planning an orienteering game. The aim of this game is to arrive at the goal (G) from the start (S...

weixin_34161032的博客 78

手机热点+Advanced IP Scanner:5分钟搞定树莓派无屏SSH连接(附详细配置截图)

本文详细介绍如何利用手机热点和Advanced IP Scanner工具快速实现树莓派的无屏SSH连接。通过简单的WiFi配置和IP扫描,5分钟内即可完成连接,特别适合外出调试或空间有限的工作环境。文章包含详细步骤、配置截图和常见问题解决方案,帮助开发者高效管理树莓派设备。

ik678901234的博客 955

2014 WAP校园招聘笔试题1

Abstract We are planning an orienteering game. The aim of this game is to arrive at the goal (G) from the start (S) with the shortest distance. However, the players have to pass all the checkpoints

csf的专栏 2775

CMOS图像传感器——工作原理

CMOS图像传感器的曝光与读出

沧海一升的博客 9460

让 ABAP 程序天生可翻译:Text Symbols 与 Text Pool 从入门到工程化落地

ABAP 国际化实践:Text Symbols 的工程价值与落地方法 摘要: 本文系统阐述了 ABAP 开发中 Text Symbols 的核心价值与实践方法。通过解耦程序逻辑与语言文本,Text Symbols 实现了代码国际化,避免了硬编码带来的维护难题。文章详细介绍了 Text Pool 结构、两种引用方式(独立引用 TEXT-001 和附着式 '(001)'),以及 SE38 和 SE63 的翻译流程。特别强调最大长度预留、术语统一等工程实践,并提供了 READ TEXTPOOL 自动化检查方案。最

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 247

58同城

58同城求职干货目录•1. 公司介绍 •1.1 58同城概况 •1.2 58同城历史 •1.3 58同城主营业务/品牌 • 1.4 58同城文化/价值观 •2. 校招介绍 •2.1 58同城2014校园招聘介绍 •2.2 58同城校园招聘流程 •3. HR答疑 •3.1 58同城校园招聘FAQ •4. 薪酬待遇 •4.1 58同城职业发展 •4.2 58同城薪酬待遇 •5. 笔试...

weixin_33918357的博客 1389

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

WAP面经 live coding

WAP面试归来本人某985小硕,记得当时宣讲会来学校宣讲,开出的薪酬十分惊人,高出BAT不少,我就跃跃欲试了。 WAP的招聘流程是 首先,完成他给的笔试题,3days内完成其中一道即可 然后是live coding面试 HR面据说不卡人 最后是传说中的INTERNSHIP 今年改成5天了 笔试题目基本上是不能在网上查到的,而且不同地区好像也不一样。有两题,一道是魔方,一道是wireless ro

jlin991的博客 1997

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

雷德算法

使用雷德算法实现倒位序:         对于自然顺序(二进制)我们是在低位加 1 得到下一位数,对于倒位序我们是在高位加 1 向低位进位。比如已知一个倒位序数是J求其下一个倒位序数,N位总数 ,把J与N/2比较若J=N/2则说明J的最高位为1 ,把最高位置0 ,比较次高位,若次高位为0 ,则把次高位置1,得到J的下一个倒位序,若次高位为1  , 则把次高位置0,以此类推... 以N = 8

知行且执行 5115

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

VS2012中CSting , std::string , char * 之间的转换

首先,设置“项目属性”-“配置属性”-“常规”-“字符集”设置为使用“使用多字节字符集” 1、从CSting到std::string std::string str ; CString cstr ; str = cstr.GetBuffer() ; 2、从std::string到CString std::string str("test") ; CString cstr ; cst

知行且执行 3827

C++中string使用

所有解释已经在程序中标明,不再单独解释 代码: //如何使用C++标准库类型中的string #include #include #include using namespace std; int main() { //1、构造函数 cout << "***********************string类的构造函数***********************" << en

知行且执行 2960

C++中vector和set删除一亿个数字中的奇数

一、vector 先贴代码再解释: #include #include #include #include using namespace std; const unsigned int NUM = 100000000; void removeOdd1(vector& a) { for(vector::iterator it = a.begin();it!=a.end();)

知行且执行 2286
上一篇: 2015小米在线笔试题
下一篇: HDU1232 畅通工程
知行且执行
博客等级 码龄14年 38粉丝 73原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值