usaco6.3.3 Cowcycles

Kali---学习过程中遇到的问题:系统更新慢,Openvas安装慢,squid代理服务器设置各种问题 一、网络问题 https://www.fujieace.com/kali-linux/networking.html Kali的Nat网络经常失效,上面的重新恢复设置的方法还是有效果的 二、更新慢的问题 网上很多答案给出的解决方案是换更新源 更好的优化方案是: 只要阿里云的源即可,其他的都不要,尤其是kali的官网更新地址,千万不能要,中科院的也不行,因为速度都垃圾 同时注释的时候一定要注意,一定... 阅读详情

一 原题

Cowcycles
Originally by Don Gillies

[International readers should note that some words are puns on cows.]

Having made a fortune on Playbov magazine, Hugh Heifer has moved from his original field in the country to a fashionable yard in the suburbs. To visit fond pastoral memories, he wishes to cowmmute back to his old stomping grounds. Being environmentally minded, Hugh wishes to transport himself using his own power on a Cowcycle (a bicycle specially fitted for his neatly manicured hooves).

Hugh weighs over a ton; as such, getting smoothly up to speed on traditional cowcycle gear sets is a bit challenging. Changing among some of the widely spaced gear ratios causes exertion that's hard on Hugh's heart.

Help Hugh outfit his Cowcycle by choosing F (1 <= F <= 5) gears (sprockets) in the front and R (1 <= R <= 10) gears in the rear of his F*R speed cowcycle subject to these rules:

  • The possible sizes (number of teeth) for the F front gears are specified.
  • The possible sizes (number of teeth) for the R rear gears are specified.
  • At any given gear setting, the gear ratio is the quotient of the number of teeth on the front gear and the number of teeth on the rear gear (i.e., number of front gear teeth divided by number of rear gear teeth)
  • The largest gear ratio must be at least three times the smallest.
  • The variance (see below) of the set of DIFFERENCES between successive (i.e., after sorting) gear ratios should be minimized.

Calculate the mean and variance of a set of differences (xi in this formula) by the following formulae:

                       1    n
               mean = ---  SUM xi
                       n   i=1   

                       1    n    
           variance = ---  SUM (xi - mean)2
                       n   i=1    

Deduce and print the optimal sets of F front gears and R rear gears so that the variance is minimized (and the ratios span a factor of at least 3x).

PROGRAM NAME: cowcycle

INPUT FORMAT

The first line contains F and R, the numbers of front and rear gears. The second line contains four numbers: F1, F2 (25 <= F1 < F2 <= 80), R1, and R2 (5 <= R1 < R2 <= 40). All front gears from F1 through F2 are available; all rear gears from R1 through R2 are available. There will exist at least one legal set of gears.

SAMPLE INPUT (file cowcycle.in)

2 5
39 62 12 28

OUTPUT FORMAT

Display the number of teeth on the set of F chosen front gears, from smallest to largest, on the first line of output (separated by spaces). Display the number of teeth on the set of R chosen rear gears, from smallest to largest, on the second line of output. All gears have an integer number of teeth, of course.

If multiple optimal answers exist, output the answer with the smallest front gear set (smallest first gear, or smallest second gear if first gears match, etc.). Likewise, if all first gears match, output the answer with the smallest rear gear set (similar rules to the front gear set).

SAMPLE OUTPUT (file cowcycle.out)

39 53
12 13 15 23 27

Comment

The challenge in this problem is "reading the problem". Don't read further if you are working on that level of challenge. If the problem is just completely unclear to you, read in.

The problem wants you to find "an optimal set of gear ratios" such that the spacing between the ratios is most uniform. Consider the test case above:

2 5
39 62 12 28
This specifies two front gears from the set 39..62; five rear gears from the set 12..28. The program must examine all possible pairs of 62-39+1=24 front gears and all possible quintuples from 28-12+1=17 rear gears. Combinatorically, The total number of possibilities is (24 take 2) times (17 take 5), which is 24!/22!/2! x 17!/5!/12! which is 656,880 possibilities (I think).

For each of these possibilities, calculations like the following. This example considers in some sense the "first" case: front gears of 39 and 40, rear gears of 12, 13, 14, 15, and 16.

First, calculate all the possible ratios:

39/12 = 3.25000000000000000000
39/13 = 3.00000000000000000000
39/14 = 2.78571428571428571428
39/15 = 2.60000000000000000000
39/16 = 2.43750000000000000000
40/12 = 3.33333333333333333333
40/13 = 3.07692307692307692307
40/14 = 2.85714285714285714285
40/15 = 2.66666666666666666666
40/16 = 2.50000000000000000000

Then, sort them:

39/16 = 2.43750000000000000000
40/16 = 2.50000000000000000000
39/15 = 2.60000000000000000000
40/15 = 2.66666666666666666666
39/14 = 2.78571428571428571428
40/14 = 2.85714285714285714285
39/13 = 3.00000000000000000000
40/13 = 3.07692307692307692307
39/12 = 3.25000000000000000000
40/12 = 3.33333333333333333333

Then, calculate the absolute value of the differences:

2.43750000000000000000 - 2.50000000000000000000 = 0.06250000000000000000
2.50000000000000000000 - 2.60000000000000000000 = 0.10000000000000000000
2.60000000000000000000 - 2.66666666666666666666 = 0.06666666666666666666
2.66666666666666666666 - 2.78571428571428571428 = 0.11904761904761904762
2.78571428571428571428 - 2.85714285714285714285 = 0.07142857142857142857
2.85714285714285714285 - 3.00000000000000000000 = 0.14285714285714285715
3.00000000000000000000 - 3.07692307692307692307 = 0.07692307692307692307
3.07692307692307692307 - 3.25000000000000000000 = 0.17307692307692307693
3.25000000000000000000 - 3.33333333333333333333 = 0.08333333333333333333

Then, calculate the mean and variance of the set of numbers on the right, above. The mean is (I think): 0.0995370370370370370366666. The variance is approximately 0.00129798488416722.

Of course this set of gears is not valid, since it does not have a 3x span from highest gear to lowest.

Find the set of gears that minimizes the variance and has a 3x or greater span. 



二 分析

要求从[f1, f2], [r1, r2]两个区间中分别取出f, r个数,将这f个数依次作为分子,r个数依次作为分母,得到一组f * r个的新数,要求新数中最大值至少是最小值的3倍,并输出新数中方差最小的一组。

题目范围较小,枚举所有可能的组合数,根据3倍的限制进行过滤,再按描述求出方差就可以了。


三 代码

运行结果:
USER: Qi Shen [maxkibb3]
TASK: cowcycle
LANG: C++

Compiling...
Compile: OK

Executing...
   Test 1: TEST OK [0.000 secs, 4360 KB]
   Test 2: TEST OK [0.042 secs, 4360 KB]
   Test 3: TEST OK [0.042 secs, 4360 KB]
   Test 4: TEST OK [0.084 secs, 4360 KB]
   Test 5: TEST OK [0.196 secs, 4360 KB]
   Test 6: TEST OK [0.056 secs, 4360 KB]
   Test 7: TEST OK [0.140 secs, 4360 KB]
   Test 8: TEST OK [0.266 secs, 4360 KB]

All tests OK.

YOUR PROGRAM ('cowcycle') WORKED FIRST TIME! That's fantastic -- and a rare thing. Please accept these special automated congratulations.


AC代码:
/*
ID:maxkibb3
LANG:C++
PROB:cowcycle
*/

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

const int maxf = 85;
const int maxr = 45;
const double inf = 1e9;

int f, r, f1, f2, r1, r2;
int candidate[2][maxf];
double ans = inf, arr[maxf * maxr], delta[maxf * maxr];
int front[maxf], rear[maxr];

double calc() {
    int cnt = 0;
    for(int i = 0; i < f; i++) {
        for(int j = 0; j < r; j++) {
            arr[cnt++] = (double)candidate[0][i] / candidate[1][j];
        }
    }
    if(cnt <= 2) return 0;
    sort(arr, arr + cnt);
    double sum = 0, sumsq = 0, avg;
    for(int i = 0; i < cnt - 1; i++) {
        delta[i] = arr[i + 1] - arr[i];
        sum += delta[i];
        sumsq += delta[i] * delta[i];
    }
    avg = sum / (cnt - 1);
    // printf("%lf\n", sumsq / (cnt - 1) - sum * sum);
    return sumsq - sum * avg;
}

void dfs2(int idx, int st) {
    if(idx == r) {
        if(candidate[0][0] * candidate[1][0] * 3 >
                candidate[0][f - 1] * candidate[1][r - 1])
            return;
        double tmp = calc();
        if(tmp < ans) {
            ans = tmp;
            memcpy(front, candidate[0], f * sizeof(int));
            memcpy(rear, candidate[1], r * sizeof(int));
        }
        return;
    }
    for(int i = st; i <= r2 - r + idx + 1; i++) {
        candidate[1][idx] = i;
        dfs2(idx + 1, i + 1);
    }
}

void dfs1(int idx, int st) {
    if(idx == f) {
        dfs2(0, r1);
        return;
    }
    for(int i = st; i <= f2 - f + idx + 1; i++) {
        candidate[0][idx] = i;
        dfs1(idx + 1, i + 1);
    }
}

void print() {
    printf("%d", front[0]);
    for(int i = 1; i < f; i++)
        printf(" %d", front[i]);
    printf("\n%d", rear[0]);
    for(int i = 1; i < r; i++)
        printf(" %d", rear[i]);
    printf("\n");
}

int main() {
    freopen("cowcycle.in", "r", stdin);
    freopen("cowcycle.out", "w", stdout);
    scanf("%d%d%d%d%d%d", &f, &r, &f1, &f2, &r1, &r2);
    dfs1(0, f1);
    print();
    return 0;
}


Kali Linux下OpenVAS漏洞库更新全攻略:解决常见报错与防火墙设置 本文详细介绍了在Kali Linux下更新OpenVAS漏洞库的完整流程,包括网络连接诊断、系统资源评估、分步更新操作指南以及常见报错解决方案。特别针对连接超时、防火墙拦截和证书错误等问题提供了实用技巧,帮助安全工程师高效完成漏洞库同步,确保扫描结果的时效性和准确性。 阅读详情

相关推荐

有限状态机FSM详解(一)

有限状态机在维基百科中的解释是: 有限状态机(英语:finite-state machine,缩写:FSM)又称有限状态自动机,简称状态机,是表示有限个状态以及在这些状态之间的转移和动作等行为的数学模型。 至于为什么要学FSM,FSM可以把模型的多状态、多状态间的转换条件解耦。可以使维护变得容易,代码也更加具有可读性,也更加艺术。 理解有限状态机首先需要理解整个模型。我们把灯的开关作为示例,...

benjonc的博客 5万+

使用kali安装OpenVAS(GVM)并进行汉化和漏洞扫描

使用kali安装OpenVAS漏洞扫描系统对设备进行安全检测

lyace2010的博客 1万+

【现代信号处理】01 -概率论与随机过程回顾

概率论与随机过程回顾 文章目录概率论与随机过程回顾1. 统计模型的相关概念1.1 统计实验(不确定性)1.2 样本点1.3 样本空间Ω1.4 概率1.5.统计模型是先验的2. 概率和统计的差异2.1 联系2.2 差异2.3.1 概率和统计问题的三要素2.3.1.1 model-模型2.3.1.2 data-数据2.3.1.3 decision-决策2.3.2 关系图3. 样本空间的重要性3.1 贝朗特悖论3.1.1 解法一3.1.2 解法二3.1.3 解法三3.2 结论4.概率相关的概念4.1 随机变量4.

qq_41741344的博客 1405

usaco 4.2 Cowcycles(搜索+剪枝)

Cowcycles Originally by Don Gillies [International readers should note that some words are puns on cows.] Having made a fortune on Playbov magazine, Hugh Heifer has moved from his original field in

志当存高远 1485

C++ 工程实践(9):数据抽象

陈硕 (giantchen_AT_gmail)http://blog.csdn.net/Solstice  http://weibo.com/giantchen陈硕关于 C++ 工程实践的系列文章: http://blog.csdn.net/Solstice/category/8

陈硕的Blog 1万+

2024届数字IC秋招-华为机试-数字芯片-笔试真题和答案(三)(含2022年和2023年)

此部分包含华为机试真题,方向是数字芯片,内容详细包括设计、验证、后端等,大部分题目给出参考答案。华为机试都是从题库里抽题目,所以这些题目还是很有参考性的,甚至是完全一样,可以搜到的。(题目内容较多,将分开编写几个文章)A.错误B.正确参考答案:BA.getB.try_getC.peekD.put参考答案:B。

qq_42135020的博客 1917

openvas介绍及部署安装 - kali Linux

OpenVas(Open VulnerabilityAssessment System)是一款开源的漏洞评估系统,是Nessus项目分支,它是一款应用级别的漏洞扫描器,用于检测并管理目标网络或主机漏洞,它的评估是基于其积累的数万个漏洞测试脚本,OpenVas最早有是一个客户端程序,目前官方已经不提供了。现基于B/S(浏览器/服务器)架构进行工作,执行扫描任务并提供扫描结果。

darlinglee006的博客 2772

SAP 清账凭证 完整生成逻辑(超详细原理 + 底层规则 + 分录逻辑 + 互清特殊规则)

【SAP清账凭证核心逻辑摘要】(149字) SAP清账凭证生成遵循两大类型:1)资金往来对冲型(如F-32/F-44互清),强制生成含完整借贷分录的独立凭证,通过AUGDT/AUGBL字段绑定未清项,典型场景如应收冲应付(借:应付账款 贷:应收账款);2)纯核销型(如F.13自动清账),仅标记行项目状态不产生实际分录。关键规则:①仅未清项管理科目可清账;②互清必须配置主数据关联;③差额清账自动补差(折扣/汇差);④原始凭证永不修改,仅更新BSIK/BSAD等表状态。清账凭证均保留可追溯性,支持FBRA重置还

金牌架构师 542

USACO 6.3.3 Cowcycles 暴力

http://train.usaco.org/usacoprob2?a=lQZ5UB8ZNRK&amp;S=cowcycle题目大意:选出两组齿轮(数量分别不超过5个和10个),设前后轮齿数比为传动比,要求:1、最大传动比至少要是最小传动比的三倍    2、将传动比排序后相邻两者差(difference)的方差要最小USACO总是出人意料,我原本以为会是一道超难的数学题或者构造题,再不济也得有个很...

Frontier_Setter的博客 396

vue2/3 - 详细实现高德地图轨迹回放,vue高德地图车辆历史行驶轨迹播放,在地图上绘制行程轨迹|起点和终端的路程绘制|用户运动轨迹绘制及播放等(支持开始/暂停、进度条拖放、控制播放轨迹的倍速等)

vue2,vue3,nuxt,高德地图,轨迹,vue高德地图轨迹回放,历史轨迹回放,轨迹回放功能支持倍速及进度条拖拽,VUE高德地图轨迹回放、倍速调整、进度条拖拽,vue3高德地图轨迹回放,Vue实现地图路径回放,vue中使用高德地图实现历史轨迹回放并能控制播放轨迹的倍速,多条轨迹陆续播放,巡航轨迹做带进度条和倍速的轨迹回放,Vue高德地图路径回放,历史轨迹回放并能控制播放轨迹的倍速,使用高德地图实现轨迹播放和进度条控制,vue高德地图如何实现轨迹回放,高德地图做轨迹绘制用什么api,高德轨迹API,驾车轨

✅ 精选推荐文章 1万+

ardupilot SBUS输入捕获

本节主要记录ardupilot 的sbus 输入捕获功能。ardupilot 默认支持多种无线协议控制输入设备,比如常用的PPM,SBUS,IBUS,DSM,SUMD,SRXL等协议,本节主要讲解ardupilot 如何通过定时器的pwm输入捕获来获取sbus数据。

陌城烟雨 271

[USACO 6.3.3] Cowcycles

题目大意   有长度为F和R的两个数组.F数组可以选择F1~F2的数放进去,R数组可以选择R1~R2的数放进去.   此时,F数组任意选择一个数除以R数组的任意一个数,这样就会形成一个新的长度为F*R的数列并求这个数列的方差.   我们要选出这样的F和R数组使得形成的F*R的数列的方差最小. 题解   直接暴搜即可.因为USACO的数据很蒻. 代码 /* TASK:cow...

weixin_30701575的博客 152

点云焊缝提取

本文介绍了一个基于PCL库的点云处理流程,包含三个核心模块:MLS平滑处理通过多项式拟合修正点云位置;差异提取通过双向匹配定位源/目标点云的非重叠区域;统计过滤剔除离群噪声点。该流程采用"平滑-筛选-净化"的通用思路,将复杂算法封装为可配置接口,实现了工业级点云预处理。文章重点分析了各模块的原理、PCL接口调用及参数设计逻辑,同时指出参数调优、算法扩展等深入探索方向,展现了PCL在点云处理中的模块化优势与实用价值。

weixin_45196569的博客 250

USACO6.3.3 Cowcycles(cowcycle)

dfs,重点在优化上,需要注意的都写到代码里了 /* ID:xsy97051 LANG:C++ PROG:cowcycle */ #include #include #include using namespace std; #define MAXF 10 #define MAXR 20+2 int ansF[MAXF];//答案F int ansR[MAXR];//答案R

xsy_victory的专栏 415

深度学习工具包 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&#39;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(&#39;DeepLearnToolbox&#39;));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(&#39;state&#39;,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&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,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 = &#39;sigm&#39;;%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, &#39;Too big error&#39;);```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(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;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)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;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, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% 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&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 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, &#39;Too big error&#39;);```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(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % 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, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % 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, &#39;Too big error&#39;);%% 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(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % 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, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

USACO 6.3 章节 你对搜索和剪枝一无所知QAQ

emmm........很久很久以前 把6.2过了 所以emmmmmm 直接跳过 ,从6.1到6.3吧 Fence Rails 题目大意 N<=50个数A1,A2... 1023个数,每个数数值<=128,B 问 A 们能拆分成多少个B,求最多的个数 样例 解释 A: 30=30 40=18+19+3 50=15+16+17+2 25=24 B: 15 (ok) 16 (ok) 17 ...

weixin_30577801的博客 252

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

USACO Training Section 4.2 Cowcycles

英文原题 中文题译   大意:   这题题意比较绕口,读懂了题目,就差不多了。干脆把中文翻译的放上来吧。   秀·谢夫(小奶牛)在花花公子杂志上中了大奖,于是她从农村搬到了城郊的一座别墅中。可是她还常常怀念乡村的生活,总想回到原来的农村逛逛。为了环保,秀决定骑上为她量身定做的奶牛自行车(特殊的自行车,专门为牛蹄设计)。 秀大约有一吨重。同样的,秀在普通的奶牛自行车上,要想骑得平平稳...

山中竹笋 309

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

USACO Cowcycles 解题报告

这道题很侥幸地过了。基本就是按照题目shuo

thestoryofsnow的专栏 726

usaco training 4.2.4 Cowcycles 题解

搜索和剪枝。

阿蒋的专栏 2127

USACO Section 4.2 Cowcycles - 枚举~

开始想复杂了...纠结了很久..后来发现数据范围很小阿...枚举所有情况也就那么多...所以就两层递归暴力枚举..结果就过了....话说这题主要还是题意要理解清楚...这里的mean和variance中的Xi..是指排好序的F[i]/R[i]的前后相差的数...其实样例下面的说明也体现了... Program: /* ID: zzyzzy12 LANG: C++ TASK:

zzyzzy12 1015

USACO SECTION 4.2 Cowcycles

Cowcycles Originally by Don Gillies [International readers should note that some words are puns on cows.] Having made a fortune on Playbov magazine, Hugh Heifer has moved from his original field

411

08-26 HDU3812 HDU3816 USACO 4.2~4.3 搜索剪枝,模拟,DP

下午在HDOJ挂了一套武汉大学第九届校赛的题目..A了几道难度偏低的题目..那道搜索剪枝剪了好久..导致别的题目都没有看了..后来才知道原来可以DP.. 主要写一下E题和I题,A和J是水题,B题是二分求解 E题 :HDU 3812 Sea Sky 搜索+剪枝 求Se

飞熊入梦 1188

USACO 4.2 Cowcycles(DFS)

使劲水啊。。。数据量太唬人了。。普通DFS就能过。。。看懂题意就好。。看不懂题是硬伤啊。。 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: cowcycle 5 */ 6 #include <cstdio> 7 #include <cstring> 8 #include <cmath&gt...

weixin_30685047的博客 104

【USACO4.2.4】奶牛自行车

其实是个水题,就按照题目意思来。 但是我题目意思看错了3次…… 写了3个多小时…… Executing... Test 1: TEST OK [0.008 secs, 3396 KB] Test 2: TEST OK [0.095 secs, 3396 KB] Test 3: TEST OK [0.054 secs, 3396 KB]

ACMer不要报考高校代码为13627的移通学院! 892

OpenVas的安装

一,docker环境 docker run -d -p 443:443 --name openvas mikesplain/openvas docker run -d -p 443:443 -e PUBLIC_HOSTNAME=192.168.10.245 --name openvas mikesplain/openvas 二、更新NVT openvas使用漏洞特征进行扫描,因此需要定期更新特征库。 docker exec -it openvas bash //进入容器,在容器中执行下面的命令 greenb

惊云 1513

OpenVas 网络安全扫描系统Docker搭建

针对 CVSS 漏洞评分系统 ,对服务器网络环境进行定级

HaSaKing的博客 3195
上一篇: cf 877D Olya and Energy Drinks
下一篇: usaco6.4.2 Electric Fences
max_kibble
博客等级 码龄11年 2粉丝 110原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值