HDU 1875 畅通工程再续【最小生成树,Prime算法+Kruskal算法】

ArcGIS Pro 制作这种地图海报 ArcMap 版本与 ArcGIS Pro 版本的制图功能相差太多,无论从美观上还是制图效率都远远优于 ArcMap,用了一段时间的 ArcGIS Pro ,真心推荐有条件的大家赶紧试一试!一个软件也能搞定一张不错的海报哦!----吐槽:好的设计真的是门花时间的活,这个教程大概花了我7小时左右,我都忘了我自己教程中截图多少张了!(可能是我速度太慢了)测试数据:阿里云盘分享-----北极海冰数据.https://www.aliyundrive.com/s/SUhsnqfkmXh。 阅读详情


畅通工程再续

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 24151    Accepted Submission(s): 7808


Problem Description
相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离不能小于10米,也不能大于1000米。当然,为了节省资金,只要求实现任意2个小岛之间有路通即可。其中桥的价格为 100元/米。
 

Input
输入包括多组数据。输入首先包括一个整数T(T <= 200),代表有T组数据。
每组数据首先是一个整数C(C <= 100),代表小岛的个数,接下来是C组坐标,代表每个小岛的坐标,这些坐标都是 0 <= x, y <= 1000的整数。
 

Output
每组输入数据输出一行,代表建桥的最小花费,结果保留一位小数。如果无法实现工程以达到全部畅通,输出”oh!”.
 

Sample Input
  
2 2 10 10 20 20 3 1 1 2 2 1000 1000
 

Sample Output
  
1414.2 oh!
 

Author
8600
 

Source

原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1875

还是最小生成树,但是有点改变,理解题目是关键“2个小岛之间的距离不能小于10米,也不能大于1000米”

这句话的意思是小岛之间的原始距离。。。

Prime算法AC代码:46ms

/**
"2个小岛之间的距离不能小于10米,也不能大于1000米"
不是任意2个小岛,只是有桥的相连两个小岛间的距离限制,
不用考虑全部连通后的任意两个小岛间的距离.
果然想太多了....

*/

#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
const int INF=0x3f3f3f3f;

struct node
{
    double x,y;
} t[105];
double a[105][105];
double dis[105];
bool vis[105];
int n;

void Prime()
{
    for(int i=0; i<n; i++)
    {
        dis[i]=a[0][i];
        vis[i]=false;
    }
    dis[0]=0;
    vis[0]=true;
    double ans=0;
    for(int i=1; i<n; i++)
    {
        int p=-1;
        double minn=INF;
        for(int j=0; j<n; j++)
        {
            if(!vis[j]&&dis[j]<minn)
                minn=dis[p=j];
        }
        if(p==-1)
        {
            cout<<"oh!"<<endl;
            return;
        }
        vis[p]=true;
        ans+=minn;
        for(int j=0; j<n; j++)
        {
            if(!vis[j]&&dis[j]>a[p][j])
                dis[j]=a[p][j];
        }
    }
    printf("%.1lf\n",ans*100);
}

int main()
{
    int T;
    cin>>T;
    while(T--)
    {
        cin>>n;
        for(int i=0; i<n; i++)
        {
            for(int j=0; j<n; j++)
                if(i==j) a[i][j]=0;
                else a[i][j]=INF;
        }
        for(int i=0; i<n; i++)
        {
            cin>>t[i].x>>t[i].y;
        }
        for(int i=0; i<n; i++)
        {
            for(int j=0; j<n; j++)
            {
                if(i==j)
                    a[i][j]=0;
                else
                {
                    a[i][j]=sqrt((t[i].x-t[j].x)*(t[i].x-t[j].x)+(t[i].y-t[j].y)*(t[i].y-t[j].y));
                    if(a[i][j]<10||a[i][j]>1000)//此处注意
                        a[i][j]=INF;
                }
            }
        }
        Prime();
    }
    return 0;
}


Kruskal算法AC代码1:530ms

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
const int INF=0x3f3f3f3f;
int fa[105];
int n,m;
struct point
{
    double x,y;
} t[105];
struct node
{
    int s,e;
    double w;
} a[5000+5];
int Find(int x)
{
    if(fa[x]==x)
        return x;
    return fa[x]=Find(fa[x]);
}
bool cmp(node a,node b)
{
    return a.w<b.w;
}
double Kruskal()
{
    for(int i=0; i<n; i++)
        fa[i]=i;
    sort(a,a+m,cmp);
    double ans=0;
    int cnt=n-1;
    for(int i=0; i<m; i++)
    {
        int x=Find(a[i].s);
        int y=Find(a[i].e);
        if(x!=y)
        {
            ans+=a[i].w;
            fa[x]=y;
        }
    }
    return ans;
}
int main()
{
    int T;
    cin>>T;
    while(T--)
    {
        cin>>n;
        for(int i=0; i<n; i++)
        {
            cin>>t[i].x>>t[i].y;
        }

        m=0;
        for(int i=0; i<n; i++)
        {
            for(int j=0; j<i; j++)
            {
                double d=sqrt((t[i].x-t[j].x)*(t[i].x-t[j].x)+(t[i].y-t[j].y)*(t[i].y-t[j].y));
                if(d>=10&&d<=1000)
                {
                    a[m].s=i;
                    a[m].e=j;
                    a[m++].w=d;
                }
            }
        }
        double ans=Kruskal();
        int cnt=0;
        for(int i=0; i<n; i++)
        {
            if(fa[i]==i)
                cnt++;
        }
        if(cnt>1)
            cout<<"oh!"<<endl;
        else
            printf("%.1lf\n",ans*100);
    }
    return 0;
}

Kruskal算法AC代码2:  530ms

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
const int INF=0x3f3f3f3f;
int fa[105];
int n,m;
struct point
{
    double x,y;
} t[105];
struct node
{
    int s,e;
    double w;
} a[5000+5];
int Find(int x)
{
    if(fa[x]==x)
        return x;
    return fa[x]=Find(fa[x]);
}
bool cmp(node a,node b)
{
    return a.w<b.w;
}
void Kruskal()
{
    for(int i=0; i<n; i++)
        fa[i]=i;
    sort(a,a+m,cmp);
    double ans=0;
    int cnt=0;
    for(int i=0; i<m; i++)
    {
        int x=Find(a[i].s);
        int y=Find(a[i].e);
        if(x!=y)
        {
            ans+=a[i].w;
            fa[x]=y;
            cnt++;
        }
        if(cnt==n-1)
        {
            printf("%.1lf\n",ans*100);
            return;
        }
    }
    cout<<"oh!"<<endl;
}
int main()
{
    int T;
    cin>>T;
    while(T--)
    {
        cin>>n;
        for(int i=0; i<n; i++)
        {
            cin>>t[i].x>>t[i].y;
        }
        m=0;
        for(int i=0; i<n; i++)
        {
            for(int j=0; j<i; j++)
            {
                double d=sqrt((t[i].x-t[j].x)*(t[i].x-t[j].x)+(t[i].y-t[j].y)*(t[i].y-t[j].y));
                if(d>=10&&d<=1000)
                {
                    a[m].s=i;
                    a[m].e=j;
                    a[m++].w=d;
                }
            }
        }
        Kruskal();
    }
    return 0;
}


SAP ABAP CO核心扩展-ZCKMLQS 多物料工厂的评估数量结构报表(CKMLQS) CKMLQS 只能查看单一物料工厂的评估数量结构,SAP 没有提供多物料工厂的评估数量结构报表。这篇文章将实现 CO核心扩展-ZCKMLQS 多物料工厂的评估数量结构报表。 阅读详情

相关推荐

遥感目标检测数据集汇总

文章目录1. 光学数据集1.1 DIOR1.2 LEVIR1.3 DOTA1.4 RSOD1.5 NWPU VHR-101.6 VEDAI1.7 COWC1.8 ITCVD1.9 DIUx xView 20181.10 HRSC20161.11 TAS1.12 SZTAKI‐INRIA1.13 UCAS AOD1.14 DLR 3K Vehicle2. SAR2.1 SSDD2.2 SSDD+2....

quanwei的博客 6万+

最小生成树 Prim hdu1875 畅通工程再续

http://acm.hdu.edu.cn/showproblem.php?pid=1875   Problem Description 相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离不能小于10米,也不能大于1000米。当然,为

while (2.0) 1282

别再只做游戏了!用虚幻引擎5(UE5)给你的工厂车间做个数字双胞胎(附数据对接教程)

本文详细介绍了如何利用虚幻引擎5(UE5)构建工业数字孪生系统,实现工厂车间的智能可视化。通过UE5的高质量渲染和实时数据处理能力,结合OPC UA和MQTT协议,打造高效的数据对接方案,提升异常识别和设备管理效率。文章还分享了模型优化、可视化设计及典型工业场景的实战案例,助力企业迈向工业4.0。

weixin_33738555的博客 212

百岛湖造桥(Kruskal)

#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;math.h&gt; int begin[100], end[100],father[100],bridgenum,islandnum; double bridge[5000]; void Sort() //对桥的长度进行升序排序 { int i,j; ...

George的博客 687

开源的预测气象大模型与数据获取/可视化

「开源气象大模型与数据获取指南」摘要: 当前主流AI气象模型(如ECMWF的AIFS、DeepMind的GraphCast、华为Pangu等)主要基于ERA5/HRES数据训练。开源资源可通过ECMWF OpenData、GitHub仓库及Google Cloud获取,其中AIFS数据采用CCBY-4.0许可可商用,其他模型多有限制性许可。典型应用流程包括:1)通过Python包获取实时预报数据;2)加载预训练权重进行推理;3)使用xarray/cartopy或Zarr进行可视化。训练数据可从CDS下载ER

专注AI大模型,软件混淆,授权 808

2025届程序技术类笔试题

希尔排序在直接插入排序的基础上进行了改进,它通过比较相距一定间隔的元素来进行,各轮比较所用的距离随着算法的进行而减小,直到只比较相邻元素的最后一轮排序为止。某人逆着水流的方向向岸边划船,每次行进前进x米后需要休息一下,休息期间船会自行倒退y米,每次休息后再次行进,前进距离缩短1/5,若起始距离岸边为m米,问:能否到达岸上,需要行进多少次才能上岸。直接插入排序的原理是将第i个元素插入前面i-1个已排好序的记录中,将比第i个元素大的记录依次向后移动一个位置,将第i个元素插入空位。第二轮相邻比较,后移2次。

博客 601

并查集进阶题

相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中, 当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖, 发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通! 经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥, 所谓符合条件,就是2个小岛之间的距离不能小于10米,也不能大于1000米。 当然,为了节省资金,只要求实现...

qq_44875007的博客 398

什么是 SAP ABAP AMDP?

SAP HANA是SAP开发的一种内存数据库管理系统,它具有出色的性能和处理大规模数据的能力。为了充分利用SAP HANA的性能,SAP引入了AMDP技术,以便将数据库操作推送到数据库服务器执行,从而减少数据传输和处理时间。AMDP方法通常需要输入参数和输出参数。输入参数用于传递数据到SQLScript代码,而输出参数用于接收SQLScript代码的结果数据。ENDMETHOD.ENDCLASS.我们定义了一个输入参数来传递销售订单数据,以及一个输出参数来接收计算结果。ENDMETHOD.

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

【HDU 1875】畅通工程再续(最小生成树,kruskal算法)

畅通工程再续Description 相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离不能小于10米,也不能大于1000米。当然

Chen_yuazzy的博客 452

关于如何在matlab中导入并翻译Hypemesh导出的大型刚度矩阵txt文本

如何将它翻译成matlab可以使用的矩阵变量,并参与运算。 由于这个大型刚度矩阵125万x125万≈1e12。matlab甚至其他计算软件无法保存这个大的一个矩阵文件。而这个刚度矩阵作为稀疏矩阵其中非零元素的数目只有有500多万。采用sparse稀疏矩阵技术是可以保存。 这里简单介绍一下这个Hypemesh导出的大型刚度矩阵txt文本。如图DMIG开头的标识符是换行符,后面两列是表示这条非零元素在刚度矩阵中列数的信息。我们已经将左边字母和符号等批量删除,得到了右边textread函数可以...

wenyusuran的专栏 1798

代谢组数据分析(五):代谢组的功能富集分析

本文介绍了代谢组数据分析中的功能分析,包括代谢物富集分析、GSEA和ssGSEA方法。文章详细阐述了分析原理、应用背景、数据准备、统计方法以及结果解释,强调了在代谢通路和代谢物ID对应关系建立、差异代谢物筛选、富集程度计算等方面的关键步骤。通过这些方法,可以揭示差异代谢物在生物过程中的作用,为疾病研究和药物开发提供依据。

专注生信领域 6000

暑假训练第15天,HDU-1875,kruskal

 畅通工程再续 相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离不能小于10米,也不能大于1000米。当然,为了节省资金,只...

weixin_42627450的博客 325

风电功率预测项目技术白皮书:短期、超短期、中长期全尺度算法详解与工程落地

聚焦风电功率预测的时间尺度与算法:短期(0~72h)以XGBoost/LightGBM/CatBoost及深度学习为主,超短期(0~4h)采用ARMA+LSTM,中长期用LightGBM等,并涵盖概率预测、多气象源融合、AI大模型+物理模型混合策略、极端天气应对及工程运维要点。

算法工程师 335

HDU - 1875 畅通工程再续

相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离不能小于10米,也不能大于1000米。当然,为了节省资金,只要求实现任意2个...

hpu风之旅 184

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

深度学习工具包 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")

畅通工程再续 HDU- 1875 (pair堆优化Prime + Kruskal )

题目连接 Prime /* * @Author: Achan * @Date: 2018-10-26 17:09:43 * @Last Modified by: Achan * @Last Modified time: 2018-10-29 17:27:28 */ //#include&lt;bits/stdc++.h&gt; #include&lt;iostream&gt; #inclu...

Harukaze 436

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

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

HDU 1875 畅通工程再续( 基础最小生成树)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1875 一直超时了,找了好久才发现我把快排比较中的>写成了-。郁闷。 Kruskal算法(基于并查集) #include #include #include #include int v[105]; struct node { int x; int y; double d

qq_16707047的专栏 274

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

HDU1875畅通工程再续(Kruskal算法求解)

畅通工程再续 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 36009    Accepted Submission(s): 12005   Problem Description 相信大家都听说一个“百岛湖”的地方吧,百岛湖的居...

逐梦者 385

还是畅通工程(最小生成树 prime算法)

某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。 Input 测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( < 100 );随后的N(N-1)/2行对应村庄间的距离,每行给出一对正整数...

o f f i c的博客 764

畅通工程+prime算法(最小生成树)

畅通工程 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 11840    Accepted Submission(s): 4804 Problem Description 省政府“畅通工程”的目标是使全省任何两个村庄间都

wenlovingliu的专栏 628

HDU 1233 还是畅通工程(最小生成树 Prime&Kruskal)

Problem Description 某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。 Input 测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( &lt; ...

第一楼主的博客 528

HDU 1301 &POJ 1215 Jungle Roads【最小生成树,Prime算法+Kruskal算法】

Jungle Roads Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6737    Accepted Submission(s): 4893 Problem Description The Head

AC_Dreameng 3263

POJ 2485 Highways【最小生成树最大边,Prime算法】

Highways Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 28592   Accepted: 13037 Description The island nation of Flatopia is perfectly flat. Unfortunately

AC_Dreameng 2528

POJ 1679 The Unique MST【MST是否唯一,Prime算法,最好的代码】

The Unique MST Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 27389   Accepted: 9816 Description Given a connected undirected graph, tell if its minimum s

AC_Dreameng 1816

POJ 2377 Bad Cowtractors【最大生成树,Prime算法】

Bad Cowtractors Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 13628   Accepted: 5632 Description Bessie has been hired to build a cheap internet network am

AC_Dreameng 1791

HDU 1102 Constructing Roads【简单最小生成树,Prime算法+Kruskal算法】

Constructing Roads Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 20765    Accepted Submission(s): 7934 Problem Description There

AC_Dreameng 1788

HDU 1233 还是畅通工程【最小生成树入门题,Kruskal算法+Prim算法】

还是畅通工程 Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 39929    Accepted Submission(s): 18144 Problem Description 某省调查乡村交通状况,得到的统计表

AC_Dreameng 1765
上一篇: HDU 1301 &POJ 1215 Jungle Roads【最小生成树,Prime算法+Kruskal算法】
下一篇: 即使没人看我们也要坚持写Blog
AC_Dreameng
博客等级 码龄12年 460粉丝 374原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值