NYOJ - 269(DP)

时间序列:R语言ARMA-GARCH模型 ARMA: #读入数据,并绘制时序图 d<-read.table("C:/Users/haha/Desktop/R/zuoye/1.txt") x<-ts(log(d),start = 1) 1: x的时间序列图: x<-ts(log(d),start = 1) plot(x) 2: 从上图可以看出x.dif序列值在0的附近波动,没... 阅读详情

http://acm.nyist.net/JudgeOnline/problem.php?pid=269

题目的主要意思假设有一个数s (1<= s <= 81) 找出 10^9的所有的位数字之和是s的个数。

主要使用DP的方法解决,动态转移方程 dp[i][j] += dp[i-1][j-k]  (0 <= k <= 9 && k < j)

#include <stdio.h>

int dp[10][82];

void func()
{
	int i,j,k;
	for(i = 1; i < 10; i++)
	{
		dp[1][i] = 1;
	}
	for(i = 2; i < 10; i++)
	{
		for(j = 1; j <= 9*i; j++)
		{
			for(k = 0; k <= 9&&k < j; k++)
			{
				dp[i][j] += dp[i-1][j-k];
			}
		}
	}
}
int main()
{
	int s,i;
	func();
	while(~scanf("%d",&s))
	{
		int count = 0;
		if(s == 1)
		{
			printf("%d\n",10);
			continue;
		}
		else
		{
			for(i = 1; i < 10; i++)
			{
				count += dp[i][s];
			}
		}
		printf("%d\n",count);
	}
	return 0;
}
在 Linux 64 位上遭遇 Signal 7 与 ST22 SYSTEM_CORE_DUMPED:从 es/implementation=std 到 /dev/shm 的一套落地排查法 摘要: Linux 64位SAP系统出现SYSTEM_CORE_DUMPED和Signal 7(对应SIGBUS)错误时,核心问题是进程因共享内存资源异常被操作系统强制终止。主要诱因包括:1)/dev/shm的tmpfs默认容量不足(通常仅占物理内存50%);2)SAP内存管理参数es/implementation=map在64位场景下的敏感性。解决方案应双管齐下:在实例profile设置es/implementation=std以降低对tmpfs的依赖,同时按(RAM+Swap)*75%重新配置/dev/ 阅读详情

相关推荐

【从零开始学Skynet】基础篇(一):Skynet环境搭建

Skynet运行于Linux操作系统,我们可以在自己的电脑上搭建虚拟机系统,也可以购买阿里云、腾讯云服务器,笔者这个系列的所有代码都是在Ubuntu16.04版本的虚拟机系统下运行编辑。

我是一条寻水的鱼 3168

NYOJ 269--VF

VF 时间限制:1000 ms  |  内存限制:65535 KB 难度:2

herongwei 的 BLOG 1497

MATLAB/Simulink BLDC电机控制模型搭建:六步换相与速度环实战

无刷直流电机(BLDC)控制是电机驱动领域的核心技术,其六步换相原理通过霍尔信号控制逆变器开关,使定子磁场与转子磁场保持垂直以产生最大转矩。在MATLAB/Simulink中搭建BLDC控制系统,需从电机本体建模入手,结合PWM占空比调节和速度环PI控制器,实现速度闭环与波形观测。该技术广泛应用于电动工具、无人机电调和伺服驱动器等场景。本文详细解析BLDC六步换相逻辑、反电动势建模及Simulink分层设计方法,帮助读者掌握从零搭建完整控制模型的工程实践。

weixin_28273593的博客 211

Nyoj 269

首先题目读的费劲!另外不能在for循环中定义变量i,j之类的,否则会超时!!! dp[i][j] += dp[i-1][j-k], i >= 2,j   #include #include #include using namespace std; const int MAXN = 82; int dp[10][MAXN];//dp[i][j]前i位之和等于j的数目 void

Abner 832

镜像电流源与比例电流源:原理、应用与性能优化

本文深入解析了镜像电流源与比例电流源的工作原理、核心应用与性能优化方法。镜像电流源利用匹配晶体管实现电流复制,是集成电路的基础;比例电流源通过发射极电阻实现电流缩放,应用更灵活。文章重点探讨了其作为有源负载提升放大器增益的关键应用,并分析了静态误差、输出阻抗和最小工作电压三大性能指标,最后介绍了威尔逊电流镜等进阶优化技术及实战设计要点。

dd012的博客 569

AutoCAD 2024 LISP实用技巧:自定义快捷命令与高效绘图工具集

本文详细介绍了如何在AutoCAD 2024中部署和使用LISP脚本,打造高效绘图工具集。通过自定义快捷命令,如WFF(超级文字查找替换)、GQT(图层隔离)和LLTJ(智能长度统计),可大幅简化图层管理、文字编辑和测量统计等重复性操作,显著提升绘图效率。

gan8painter的博客 324

NYOJ269VF【dp】

VF 时间限制:1000 ms  |            内存限制:65535 KB 难度:2 描述 Vasya is the beginning mathematician. He decided to make an important contribution to the science and to become famous all over the worl

走一步再走一步 649

Qt实现离线缓存地图(附完整源码)

Qt实现离线缓存地图(附完整源码)

希望我的博客,能帮上你解决学习中工作中所遇到的问题 865

nyoj 269——VF——————【dp】

VF 时间限制:1000ms | 内存限制:65535KB 难度:2 描述 Vasya is the beginning mathematician. He decided to make an important contribution to the science and to become famous all over the world. But ho...

weixin_30819085的博客 157

麻雀搜索算法(SSA)详解:从鸟群智能到优化实践

麻雀搜索算法(SSA)是一种新型群智能优化算法,模拟麻雀群体的觅食行为和反捕食机制。该算法将优化问题转化为麻雀群体对食物源的搜索过程,通过发现者、加入者和警戒者的角色分工实现高效优化。SSA具有原理新颖、参数合理、收敛快速等特点,在函数优化、工程设计和机器学习等领域展现出良好应用前景。算法通过数学模型模拟麻雀的觅食策略,包括发现者全局探索、加入者局部开发和警戒者危险预警机制,有效平衡了全局搜索与局部开发能力。SSA相比传统优化算法具有更好的收敛性和优化效果。

qq_42212808的博客 1075

告别Python中间件!C#原生调用YOLOv11/v12:工业视觉检测零语言壁垒全流程

本文介绍了一种基于C#和ONNX Runtime的工业视觉检测解决方案,解决了传统YOLO模型在工业应用中面临的三大痛点:语言壁垒、性能损耗和模型更新困难。该系统采用三层架构设计,支持C#原生调用YOLO模型,无需中间件,性能损耗低于5%,满足工业产线30FPS+的实时性要求。文章详细阐述了环境搭建、模型导出规范、核心代码实现及工业级优化方案,提供可直接用于生产环境的完整流程,实现了训练与部署的解耦,显著降低了维护成本。该方案兼容主流YOLO版本,支持全平台部署,为工业视觉检测提供了高效可靠的C#集成方案。

这里只有干货:从 Modbus 通信到 MES 对接,从 YOLO 训练到工控机部署,带你搞定工业软件开发全流程。 190

NYOJ-269-VF(DP不好理解)

题目连接:http://acm.nyist.net/JudgeOnline/problem.php?pid=269   题意:在1到n=10^9的范围里,输出其中各个位上数字之和等于给定的整数m(1~81)的个数   状态转移方程:d[i]][j]=d[i][j]+d[i-1][j-k] (0   代码如下: #include #include#includeint dp[10][

花落留香 1177

Android11车机系统海外项目资源包RRO方案优化

本文介绍了汽车设置应用如何通过Android RRO(运行时资源叠加)方案实现多车型差异化资源管理。针对不同车型(国内/海外、轿车/SUV)和配置(方向盘、轮毂等),采用产品变体(productFlavors)构建不同APK版本,并通过JSON配置文件动态启用对应资源包。系统根据车辆下线配置自动匹配适用的资源叠加包,解决了硬编码判断带来的维护问题。该方案实现了资源的高效复用,同时支持灵活配置多种车型组合,为汽车行业多车型共平台开发提供了可扩展的技术实现。

shusuanly的博客 470

nyoj269VF(dp)

 VF 时间限制:1000 ms  |  内存限制:65535 KB 难度:2 描述 Vasya is the beginning mathematician. He decided to make an important contribution to the science and to become famous all over the world. But

>*,< 220

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

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

NYOJ 269 VF(基础dp)(待补充)

VF时间限制:1000 ms  |  内存限制:65535 KB 难度:2描述 Vasya is the beginning mathematician. He decided to make an important contribution to the science and to become famous all over the world. But how can...

Jackie035 286

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

nyoj VF 269 (DP)求数字和的个数

VF 时间限制:1000 ms  |           内存限制:65535 KB 难度:2 描述 Vasya is the beginning mathematician. He decided to make an important contribution to the science and to become famous all over the world.

yanghui07216的博客 436

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

(NYoj 269) VF --经典DP问题--下一个状态为前多个状态之和

VF 时间限制:1000 ms | 内存限制:65535 KB 难度:2 描述 Vasya is the beginning mathematician. He decided to make an important contribution to the science and to become famous all over the world. But how can he d

STILLxjy 564

NYOJ 269 VF

题意:在1--1e9中,求出所有位数相加为s的个数s是自己给出的 s的范围[1,81] ac代码: #include<bits/stdc++.h> using namespace std; //#define maxn 1005 int dp[10][82]; void slove_dp() { for(int i=1; i<10; i++) { ...

yangzijiangac的博客 161

nyoj 269 VF

VF 时间限制:1000 ms  |  内存限制:65535 KB 链接:NYOJ269 题意:1~1000000000之间,各位数字之和等于给定s的数的个数。 每行给出一个数s(1 ≤ s ≤ 81),求出1~10^9内各位数之和与s相等的数的个数。 1、只有s=1时,10^9的系数才能为1,否则就大于10^9。 所以和为1的要单一列出来。 2、如果s!=1:定

CodeDream 570

【动态规划】 nyoj269 VF

题目链接:VF     起初看到题的时候看半天没理解什么意思,后来才理解题意是,给你一个S (1~81)让求出1~10^9之间所有数中各位数字之和等于S的数的个数, 知道题意也知道是动态规划,可是自己还是没推出状态转移方程式,也是看了博客才恍然大悟, 1、当s=1时,10^9的系数才能为1,否则就大于10^9。 所以和为1的要单一特判下。 2、如果s!=1:定义状态dp[

迎着太阳 清澈生活 712

nyoj269VF

 /*VF 时间限制:1000 ms | 内存限制:65535 KB 难度:2 描述 Vasya is the beginning mathematician. He decided to make an important contribution to the science and to become famous all over the world. But how can h...

iron的博客 720

01串&&VF(nyoj 252 && nyoj 269)

这几天看了动态规划的一些知识,然后找了两个难度低的做了做。。。感觉状态转移方程好难想啊T T,总之练习的道路还长着呢  加油吧 01串 时间限制:1000 ms  |  内存限制:65535 KB 难度:2 描述 ACM的zyc在研究01串,他知道某一01串的长度,但他想知道不含有“11”子串的这种长度的01串共有多少个,他希望你能帮帮他。 注:01串的长度为2时,有3种:0

23333333 695

nyoj-269 VF

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=269其实使用0-1背包不怎么熟练,看完这个讲解后才算是对这道题目理解了: http://blog.youkuaiyun.com/u013050857/article/details/38373119 我的代码: 】 #include #include int main(){ int dp[10][8

wojiaohuangyu的专栏 685

nyoj269 VF

VF时间限制:1000 ms  |  内存限制:65535 KB难度:2描述Vasya is the beginning mathematician. He decided to make an important contribution to the science and to become famous all over the world. But how can he do that ...

popcjz的博客 1244
上一篇: NYOJ - 苹果(dp-01背包问题)
下一篇: NYOJ - 擅长排列的小明 II
SevenMIT
博客等级 码龄15年 60粉丝 162原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值