HDU - 3723 Delta Wave 卡特兰数

4B模型+GGUF+llama.cpp:消费级硬件上的自动化编码实践 自动化编码并非单纯依赖大参数模型,而是由轻量级模型、高效格式与专用推理引擎共同构建的技术闭环。GGUF格式通过分块存储与原生量化支持,显著降低内存占用与加载延迟;llama.cpp则针对CPU/ARM设备优化内存映射与KV缓存管理,使4B级模型在树莓派、Windows台式机等消费级硬件上实现亚秒级首token响应和稳定吞吐。这种组合让开发者无需纠结CUDA驱动兼容性、显存碎片或环境配置,真正聚焦于需求描述本身。qwen2.5-4b作为典型代表,在代码生成质量、PEP8合规性、type hints完整性等方面 阅读详情

题目:让你输出从点(0,0)到点(N,0)一共有多少种方法,点(r,c)可以到点(r,c+1),(r+1,c+1),(r-1,c+1),但是不能走到x轴的下方。

下图是N=4的方法


Sample Input
3
4
Sample Output
4
9


思路:行数要么+1,要么+0,要么-1,因为不能到x轴的下方,所以任意时刻+1的次数都要大于等于-1的次数,所以就是卡特兰数了呀。

设总的+1的次数为i

ans+=C(n,2*i)*h(i-1)*(4*i-2)/(i+1)

代码:

import java.math.*;
import java.util.*;

public class Main {
	static BigInteger one = BigInteger.ONE;
	static BigInteger two =BigInteger.valueOf(2);
	static BigInteger zero = BigInteger.ZERO;
	static BigInteger ten = BigInteger.TEN;
	
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int n;
		while(cin.hasNext()){
			n=cin.nextInt();
			BigInteger ans=one,h=one,C=one;
			int y=0;
			for(int i=1;2*i<=n;i++){
				C=C.multiply(BigInteger.valueOf(n-y)).divide(BigInteger.valueOf(y+1));
				y++;
				C=C.multiply(BigInteger.valueOf(n-y)).divide(BigInteger.valueOf(y+1));
				y++;
				h=h.multiply(BigInteger.valueOf(4*i-2)).divide(BigInteger.valueOf(i+1));
			//	System.out.println(C+"  "+h);
				ans=ans.add(h.multiply(C));
			}
			ans=ans.mod(ten.pow(100));
			System.out.println(ans);
		}
		cin.close();
	}
}



告别OFDM卡顿:用MATLAB手把手仿真AFDM波形,搞定高铁、无人机通信的时变信道难题 本文详细介绍了如何使用MATLAB仿真AFDM波形,解决高铁和无人机通信中的时变信道难题。通过仿射变换技术,AFDM在多普勒频移严重的场景下表现优异,显著提升通信质量。文章包含参数配置、波形生成、性能对比等实战内容,适合通信工程师和研究人员参考。 阅读详情

相关推荐

Blender点云渲染实战:用Geometry Nodes快速搞定论文配图(附Cycles渲染技巧)

本文详细介绍了如何利用Blender的Geometry Nodes系统,高效地将三维点云数据转化为高质量的科研论文配图。通过实战步骤,从数据导入、节点化几何处理、材质赋予到Cycles渲染引擎的优化设置,手把手教你制作出专业、美观的可视化图像,助力科研成果展示。

hp777的博客 264

hdu3723(卡特兰数组合数)

A delta wave is a high amplitude brain wave in humans with a frequency of 1 – 4 hertz which can be recorded with an electroencephalogram (EEG) and is usually associated with slow-wave sleep (SWS).

small__snail__5的博客 730

实战指南:如何用Kamailio+FreeSWITCH搭建高并发企业通信系统(附配置模板)

本文提供了一份实战指南,详细介绍了如何利用Kamailio与FreeSWITCH构建高并发企业通信系统。通过将Kamailio作为高性能SIP信令平面处理路由与负载均衡,FreeSWITCH作为媒体与应用平面负责通话与业务逻辑,实现信令与媒体分离的电信级架构。文章深入解析了架构设计、核心配置、集群部署与性能优化,并附有配置模板,旨在帮助企业构建可水平扩展、高可用的通信解决方案。

dell8的博客 364

hdu 3723 Delta Wave(卡特兰数)

题目大意: 按照图中的三种方式移动。 要求不能超过Y轴。只能在Y轴上方移动。而且经过N步以后一定要到达  (N.0); 思路: 想到了是卡特兰数  然后枚举一下选了多少平走的   设卡特兰书是  F 那么就是 1-n/2    累加  C(n, i*2) *F[i]... 似乎这个卡了JAVA大数的上限。 第一份代码就过不去了。。。求大神指点。。。 思路也是一样。先预处理

Jinx Jinx again 1170

Claude Code 完全指南:从入门到精通

《AI编程助手ClaudeCode深度指南》摘要 ClaudeCode作为新一代AI编程助手,凭借200K tokens的超长上下文窗口和深度代码理解能力,正在重塑开发工作流程。本文系统介绍了从安装配置到高级应用的完整使用指南: 核心优势包括: 项目级代码理解能力 Agent自主规划复杂任务 原生终端集成支持 多文件协同编辑功能 实战应用场景: 快速理解陌生项目架构 诊断性能瓶颈并提供优化方案 自动生成符合规范的API代码 开发可复用技术组件 高级技巧: 通过CLAUDE.md定义项目规范 合理使用/cle

分享AI、区块链技术及应用,未来已来 603

CQE和SQE 以及 PQA和DQA的区别

‌:PQA聚焦产品全生命周期流程管理,DQA专注于设计阶段的质量控制。

a1809032425的博客 1900

la5028

此题是hdu3723 此题首先想有点像栈,因为最后要回到第一排。所以向上一个必然向下一个,这就有点像栈进去一个出来一个。然后呢,求组合个数。那这是不是就是卡特兰数呢?今天正好看了组合数学卡特兰数。 那么上下是卡特兰数的个数,这里还有横线的个数,横线可以理解为在上下中插入横线。比方说:n=4的时候,在上的个数为1下的个数为1的时候,卡特兰数为1,那么还余下2个位置需要放横线,横线插入到里面的

lyc 1108

把 ABAP 开发对象装进 XML 行李箱:SAPlink 安装、插件、升级与协作迁移全指南

SAPlink是一款用于在SAP NetWeaver系统间导入导出ABAP对象的工具,特别适合临时协作、系统孤岛等场景。它通过XML文件(Slinkee和Nugget两种格式)传输开发对象,支持插件扩展多种对象类型。安装时需注意版本兼容性、权限和激活流程,使用时要区分覆盖选项的风险。相比正式运输系统,SAPlink更适用于快速共享、原型交付等非生产场景,但需配合命名规范和协作策略确保可维护性。

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

hdu 3723 卡特兰数

Delta Wave Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 690    Accepted Submission(s): 223 Problem Description A delta wave is a hig

_rabbit的专栏 1389

基于YOLOv13+CBAM注意力机制

本教程详细介绍了CBAM注意力机制的原理及其在YOLOv13中的集成方法。CBAM通过通道注意力和空间注意力两个模块,动态调整特征权重以增强模型性能。通道模块利用池化操作和共享MLP生成通道权重,空间模块则通过池化和卷积生成空间权重。教程提供了在YOLOv13中实现CBAM的具体步骤,包括模块代码定义、模型配置修改等关键环节,帮助开发者在目标检测任务中提升模型表现。

FJN110的博客 305

【高级强化学习:算法、优化与泛化】第13章 扩散模型策略优化(Diffusion Policy Optimization)

\quad$ 计算均值 $\mu_t = \frac{1}{\sqrt{\alpha_t}} \left( x_t - \frac{1 - \alpha_t}{\sqrt{1 - \bar{\alpha}_t}} \tilde{\epsilon} \right)$.$\quad$ 组合得分估计: $\tilde{\epsilon} = \epsilon_{\text{unc}} + w \cdot (\epsilon_{\text{con}} - \epsilon_{\text{unc}})$.

u012133341的博客 336

HDU 3723 Delta Wave(卡特兰数)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3723 题意:从(0,0)到(n,0),x方向没前进一格,y方向只能上升、下降一格或者不变。有多少种方案? 思路:设n个格子中有k次上升的,那么就有k次下降的,这2k次的排列方案可以看做括号序列的方案数,即卡特兰数,设f[k]表示前这2k个上升下降的排列方案数,g[k]表示总的方案数   ...

weixin_33985679的博客 248

深度学习工具包 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 3723 Delta Wave(组合计数,卡特兰数)

转载请注明出处,谢谢http://blog.youkuaiyun.com/ACM_cxlove?viewmode=contents    by---cxlove 题目:从坐标系的第一象限,0,0点到n,0点,不能到x轴以下,每次y值差值最大为1,也就是要么加1,要么减1,要么不变。问有多少种 http://acm.hdu.edu.cn/showproblem.php?pid=3723  其实是一

窝不是爱酱,喵~~~~ 3346

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

HDU3723 Delta Wave(卡特兰数,java大数)

Problem Description A delta wave is a high amplitude brain wave in humans with a frequency of 1 – 4 hertz which can be recorded with an electroencephalogram (EEG) and is usually associated with slow-w...

tomjobs的博客 539

HDU3723 Delta Wave —— 卡特兰数

题目链接:https://vjudge.net/problem/HDU-3723 Delta Wave Time Limit: 6000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1468Accepted Submission(s): 48...

weixin_30537451的博客 102

卡特兰数 (hdu3723 Delta Wave)

链接:http://acm.hdu.edu.cn/showproblem.php?pid=3723 Delta Wave Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1269    Accepted Submission

一七得七 476

HDU 3723 Delta Wave(卡特兰数+大数)

题意:从坐标(0, 0)到(n, 0)的折线,这条折线每向右延伸一个单位长度,高度要么不变,要么+1,要么-1,(不能到y=0以下)已知n,求这种折线种数 思路:我们知道上升和下降的次数要一样,而这就像卡特兰数的入栈出栈次序一样,所以我们从n中选出2k次进行类出栈模拟, 那么ans[k] = C[n][2k]*C[2k][k]/(k+1),计算组合数n^2会T,然后我们可以相除ans[k-1]

CillyB的博客 690

LA 5092 && hdu 3723 Delta Wave (卡特兰数)

题目:http://acm.hdu.edu.cn/showproblem.php?pid=3723 and http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=20568 题意:有种折线每向右延伸一个单位长度,高度要么不变,要么加1,要么减1。而且任何时刻高度不能低于0。求这种折线最终高度为0的情况总数。 分析:由于任何时刻斜

w20810的专栏 781

HDU-3723 Delta Wave(卡特兰数+大数递推)

A delta wave is a high amplitude brain wave in humans with a frequency of 1 – 4 hertz which can be recorded with an electroencephalogram (EEG) and is usually associated with slow-wave sleep (SWS). -- from Wikipedia The researchers have discovered a new k

yo_bc的博客 521

HDU 3723 Delta Wave

题目链接:HDU3723 Delta Wave Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 608    Accepted Submission(s): 199 Problem Descriptio

Salvare219 1064

HDU 3723 Delta Wave(2010 Asia Tianjin Regional Contest )

【题目链接】http://acm.hdu.edu.cn/showproblem.php?pid=3723【解题报告】 结论题,知道是卡特兰数的话就会很好写。 我们知道最后偏移量为0,所以假如向上偏移一次,就一定会有对应的向下偏移一次。这类似一个入栈出栈操作。 假如有i次入栈,那么对应的i个数的出栈序列为: 2*C( 2i,n )*Cat(i). 其中: c

gungnir0711的博客 1154

hdu 3723 Delta Wave

Delta Wave hdu 3723Problem Description A delta wave is a high amplitude brain wave in humans with a frequency of 1 – 4 hertz which can be recorded with an electroencephalogram (EEG) and is usually as

HJ 1048

HDU3723 Delta Wave

之前做过一道卡特兰数的题目。但那个题目比较直接,很容易看出是卡特兰数。但这道题目需要自己去观察。 对卡特兰数的了解不要仅仅局限在它的公式上,还要去了解它的各种应用。其中有一个栈的应用:就是说给一个1-n的数列,求其入栈出栈后序列的个数。上图中,如果我们把横线去掉,就是斜线往上往下。我们把斜线往上看做入栈,往下看做出栈,就和卡特兰数栈的应用一样。而其余横线我们可以随便插入,就是一个组合数。想到

七里的专栏 1146

HDU-3723-DeltaWave

package acm; import java.math.BigInteger; import java.util.Scanner; /* * hdu 3723 Delta Wave * slowlight * 2014-7-13 * 卡特兰数 H(n) = H(0)*H(n-1)+H(1)*H(n-2)...+H(n-1)*H(0) = C(2n, n)/(n + 1) */ pu

slowlight93的专栏 618

HDU3723 组合数+卡特兰数+java大数

Delta Wave Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 706    Accepted Submission(s): 228 Problem Description A delta wave is a hig

Sky-J的代码篮子 817
上一篇: HDU - 4390 Number Sequence 容斥定理
下一篇: HDU - 4418 Time travel 高斯消元求期望
我不会额
博客等级 码龄11年 2粉丝 173原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值