HDU5095 Linearization of the kernel functions in SVM(模拟)

Hodgkin-Huxley Model 介绍了经典的动力学模型:HH Model 阅读详情

Linearization of the kernel functions in SVM

题目链接:

http://acm.hdu.edu.cn/showproblem.php?pid=5095

解题思路:

很坑的一道模拟题,注意1,-1和全为0时的结果。

我写了两份代码,一份思路比较清晰,一份比较乱,勿喷。

AC代码(比较清晰的):

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    char b[]={'p','q','r','u','v','w','x','y','z'};
    int T;
    scanf("%d",&T);
    while(T--)
    {
        int x,i,flag=0;
        for(i=0;i<9;i++)
        {
            scanf("%d",&x);
            if(x==0)
                continue;
            flag++;
            if(flag==1||x<0)
            {
                if(x==-1)
                    printf("-%c",b[i]);
                else if(x==1)
                    printf("%c",b[i]);
                else
                    printf("%d%c",x,b[i]);
            }
            else
            {
                if(x==1)
                    printf("+%c",b[i]);
                else
                    printf("+%d%c",x,b[i]);
            }
        }
        scanf("%d",&x);
        if(x)
        {
            if(flag&&x>0)
                printf("+%d",x);
            else
                printf("%d",x);
        }
        if(flag==0&&x==0)
            printf("0");
        printf("\n");

    }
    return 0;
}

AC代码(比较乱的):

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        int i=1,x,flag=1;
        char c='p';
        scanf("%d",&x);
        if(x!=0)
        {
            flag=0;
            if(x==1)
                printf("%c",c);
            else if(x==-1)
                printf("-%c",c);
            else
                printf("%d%c",x,c);
        }
        else
        {
            while(x==0&&i<9)
            {
                scanf("%d",&x);
                i++;c++;
                if(c=='s')
                    c+=2;
                if(x!=0)
                {
                    flag=0;
                    if(x==1)
                        printf("%c",c);
                    else if(x==-1)
                        printf("-%c",c);
                    else
                    printf("%d%c",x,c);
                }
            }
        }
        for(;i<9;i++)
        {
            scanf("%d",&x);
            c++;
            if(c=='s')
                c+=2;
            if(x!=0)
            {
                flag=0;
                if(x==1)
                    printf("+%c",c);
                else if(x==-1)
                    printf("-%c",c);
                else
                {
                    if(x>0)
                        cout<<'+';
                    printf("%d%c",x,c);
                }
            }
        }
        scanf("%d",&x);
        if(flag)
            printf("%d",x);
        else if(x!=0)
        {
            if(x<0)
                printf("%d",x);
            else
                printf("+%d",x);
        }
        printf("\n");
    }
    return 0;
}

顺便给几组比较好的测试数组:

99
0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0 0 0
-1 -1 -1 -41 -1 -1 -1 -1 -1 -1
-1 5 -2 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 1
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
0 0 0 0 0 -1 -1 -1 -1 -1
0 0 0 0 0 1 1 1 1 1
1 1 1 1 1 0 0 0 0 0
-1 -1 -1 -1 -1 0 0 0 0 0
1 1 1 1 1 1 1 1 1 0



再不入坑就晚了,深度神经网络概念大整理,最简单的神经网络是什么样子? 阅读详情

相关推荐

Linux运维踩坑实录:手把手教你修复LVM中PV显示[unknown]的诡异问题

本文详细解析了Linux运维中LVM物理卷(PV)显示[unknown]的故障现象及修复方法。通过分析问题根源、提供标准修复流程和特殊场景处理方案,帮助运维人员快速解决VG容量异常、PV状态丢失等问题,并分享预防措施与最佳实践,确保LVM存储系统的稳定运行。

weixin_26869081的博客 364

HDU 5095--Linearization of the kernel functions in SVM【模拟】

Linearization of the kernel functions in SVM Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 2232    Accepted Submission(s): 598 Problem

_阿阿阿阿欢 921

Anaconda下安装LabelImg

Anaconda下安装LabelImg

LYH8543的博客 766

HDU 5095 Linearization of the kernel functions in SVM(模拟, 水题)

现场最水的一题,1A,对代码功和细心程度还是有一定考验的。以下代码是赛后重写的,当时写的比较乱,没用函数,各种重复的if写了10段。。 按平时写数学式子的常理输出。注意几个细节,全0、第一个为正、系数为1、常数项为1等。

wujy的专栏 777

OpenCV卡尺工具实战:5步搞定工业级圆与直线拟合(附完整C++源码)

本文详细介绍了使用OpenCV卡尺测量工具实现工业级圆与直线拟合的5个关键步骤,包括核心原理、环境配置、边缘点提取优化、鲁棒性几何拟合实现及QT集成技巧。通过模块化C++源码和实战案例,帮助开发者快速掌握高精度尺寸测量技术,适用于机械零件、PCB板等工业检测场景。

uran的专栏 850

深入解析mSATA与mini-PCIE接口的硬件设计要点

本文深入解析mSATA与mini-PCIE接口的硬件设计要点,涵盖信号定义、电源设计、高速信号处理及PCB布局布线等关键内容。通过实战案例和调试技巧,帮助工程师规避常见设计陷阱,提升电路设计效率,特别适合工业控制和嵌入式系统开发场景。

weixin_28741413的博客 328

HDU 5095 Linearization of the kernel functions in SVM【模拟】

Linearization of the kernel functions in SVM Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 2243    Accepted Submission(s): 602 P

Corn 452

COMSOL仿真教程—激光烧蚀

本例使用二维模型,将来自激光的入射热通量模拟为金属表面上空间分布的热源,从而得到金属的烧蚀过程和瞬态温度分布。

qq_40977332的博客 2万+

hdu 5095 Linearization of the kernel functions in SVM(模拟)

hdu 5095 Linearization of the kernel functions in SVM(模拟) —— black的专栏——waShaXiu

black的专栏 1012

汽车UDS诊断之诊断会话控制服务(0x10)深度剖析

DiagnosticSessionControl就是诊断会话控制。 请求消息定义 A_Data类型 参数名称 Cvt 字节值 助记符 #1 诊断会话控制请求SID M 0x10 DSC #2 子功能=[诊断会话类型] M 0x00-0xFF LEV_DS_ ...

心骗小白话的博客 7430

Isaac Sim 入门教程(四)强化学习策略训练宇树人形机器人四足机器人示例

isaac_sim_policy_example Extension 是在 Isaac Sim 中部署 Isaac Lab 强化学习策略的一个框架和一组辅助函数。有关在 Isaac Sim 中训练和构建策略的详细信息,请访问在 Isaac Sim 中部署策略。该扩展程序默认已启用。如果被禁用,可在扩展管理器中搜索 isaacsim.robot.policy.example 重新启用。要运行下面的示例,请激活 “视窗”>“示例”>“机器人示例”,这将打开 “机器人示例 ”选项卡。

机器人控制与仿真应用 3958

HDU 5095 Linearization of the kernel functions in SVM(模拟)

HDU 5095 Linearization of the kernel functions in SVM(模拟)

1633

麒麟系统无法进入单用户模式该怎么办?

🏆本文收录于《全栈Bug调优(实战版)》专栏,主要记录项目实战过程中所遇到的Bug或因后果及提供真实有效的解决方案,希望能够助你一臂之力,帮你早日登顶实现财富自由🚀;同时,欢迎大家关注&&收藏&&订阅!持续更新中,up!up!up!! 备注:部分问题/疑难杂症搜集于互联网。

**My Coding Family** 1830

hdu 5095 Linearization of the kernel functions in SVM(模拟)

Linearization of the kernel functions in SVM Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 2242    Accepted Submission(s): 601 Problem

莫道青天真无道,能逍遥时且逍遥! 872

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

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

hdu 5095 Linearization of the kernel functions in SVM(模拟)

Problem Description SVM(Support Vector Machine)is an important classification tool, which has a wide range of applications in cluster analysis, community division and so on. SVM The kernel functions u

HJ 753

inori mmd 7z

楪祈的模型资源....................................................................................................................................................................................................................

hdu 5095 Linearization of the kernel functions in SVM (简单模拟)

Linearization of the kernel functions in SVM Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 2227    Accepted Submission(s): 595 Problem

hpugym的专栏 406

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

F - Linearization of the kernel functions in SVM HDU - 5095(模拟)

SVM(Support Vector Machine)is an important classification tool, which has a wide range of applications in cluster analysis, community division and so on. SVM The kernel functions used in SVM have many...

码农的一亩三分地 240

hdu 5095 Linearization of the kernel functions in SVM(模拟,分类清楚就行)

题意: INPUT: The input of the first line is an integer T, which is the number of test data (T<120). Then T data follows. For each data, there are 10 integer numbers on one line, which are the ...

weixin_30578677的博客 83

HDU 5095 Linearization of the kernel functions in SVM

Linearization of the kernel functions in SVM Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 206    Accepted Submission(s): 109 Proble

浮生匆忙,与君同往 444

HDU5095——水过——Linearization of the kernel functions in SVM

Problem Description SVM(Support Vector Machine)is an important classification tool, which has a wide range of applications in cluster analysis, community division and so on. SVM The kernel funct...

dgjm4087的博客 181

hdu 5095 Linearization of the kernel functions in SVM(水题)

题目链接:hdu 5095 Linearization of the kernel functions in SVM 题目大意:给定一个多项式的系数,输出多项式。 解题思路:水题,注意细节。系数为0不输出,系数为1忽略。 #include #include #include #include using namespace std; int main () { i

不慌不忙、不急不躁 1304

HDU 5095Linearization of the kernel functions in SVM(水题)

Linearization of the kernel functions in SVM                                                                                                             点击打开题目链接 Time Limit: 2000/1000 MS (Java/Other

975
上一篇: POJ题目分类
下一篇: HDU5090 Game with Pearls(贪心)
yphacker
博客等级 码龄12年 199粉丝 540原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址