HDU - 1398 Square Coins

华大HC32F460 ADC+DMA高效数据采集实战解析 本文深入解析了华大HC32F460微控制器中ADC与DMA协同工作的高效数据采集方案。通过实战代码演示,详细阐述了如何配置硬件触发、序列扫描及AOS事件联动,实现后台自动采集,从而解放CPU资源,提升系统实时性与可靠性,适用于传感器数据采集、音频处理等多种场景。 阅读详情

题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=1398

 

母函数题目。

构造生成函数:(1+x+x^2+x^3+...+x^n)*(1+x^4+x^8+...)*(1+x^9+x^18+...)*...*(1+x^n)

求取其中x^n的系数即可。

代码:

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ull unsigned long long
#define __ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

const int maxn = 1e5 + 10;
const ll mod = 1e9 + 7;

int c1[maxn], c2[maxn];

int main() {
    __;
    int n;
    while (cin >> n) {
        if (n == 0)break;
        for (int i = 0; i <= n; ++i) {
            c1[i] = 1;
            c2[i] = 0;
        }
        for (int i = 2; i <= n; ++i) {
            int t = i * i;
            for (int j = 0; j <= n; ++j) {
                for (int k = 0; k + j <= n; k += t) {
                    c2[j + k] += c1[j];
                }
            }
            for (int j = 0; j <= n; ++j) {
                c1[j] = c2[j];
                c2[j] = 0;
            }
        }
        cout << c1[n] << endl;
    }
    return 0;
}

 

YOLOv11架构革新:华为VanillaNet与BiFPN深度融合的突破性改进实战指南 购买即可解锁300+YOLO优化文章,并且还有海量深度学习复现项目,价格仅需两杯奶茶的钱,别人有的本专栏也有! 阅读详情

相关推荐

海康VisionMaster表面缺陷滤波实战:从参数调优到工业检测落地

本文深入解析海康VisionMaster表面缺陷滤波模块在工业检测中的应用。通过铝壳划痕检测实战案例,详细阐述了从参数调优(滤波核尺寸、方向权重、偏移)到ROI划定、Blob后处理的完整流程,旨在帮助工程师有效提升检测信噪比,实现缺陷精准定位与高效识别,最终推动项目稳定落地。

weixin_29051811的博客 638

【DP_构成状态的种类数】HDU 1398 Square Coins

HDU 1398 Square Coins 题意:有1->17的平方数价值的金币,问用这些金币组成1->300内任意价值,有多少种组合方法。 思路:我们从小到大依次用这些平方数来组成1->300的价值 1:dp[ i ]=1; 4:dp[ 4 ]+=dp[ 4-4 ]=2; dp[ 5 ]+=dp[ 5-4 ]=2; dp[ 9 ]+=dp[ 9-4 ]=3; 9:dp[ 9 ...

L_X_ 230

华为iTrustee实战:5分钟搞定TrustZone环境搭建(附BoostKit配置技巧)

本文提供了一份华为iTrustee与ARM TrustZone环境的5分钟快速搭建实战指南。详细介绍了在TaiShan服务器上利用鲲鹏BoostKit套件部署可信执行环境(TEE)的完整流程,包括环境检查、驱动安装、首个可信应用(TA)的编译与运行,并分享了关键的BoostKit配置技巧与深度排错方法,助力开发者快速为业务注入硬件级安全能力。

yoga7的博客 975

hdu 1398 Square Coins(母函数/完全背包)

Square Coins Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 11418    Accepted Submission(s): 7827 Problem Description People in Si

TUT我好菜啊 543

网格自适应_Comsol案例解析17:自适应网格的使用

本期导读自适应网格细化有许多优势,比如可以不用对网格进行全局加密,增加计算精度,又会降低求解自由度。本期仍然以气泡上升案例为例,在两相流模块中使用自适应网格。【打开案例模型】【修改网格】适当让气泡边界加密,注意,曲率因子越小,曲线上的网格越密【添加自适应网格】使用默认的参数即可,这里的误差指示器用的是水平集phi。可以根据具体求解模型选择适当的自变量作为误差指示器。【口诀】默认的一般是最...

weixin_28726871的博客 5691

企业IT运维实录:批量部署银河麒麟V10-SP1,Ghost镜像与UKey激活实战

本文详细介绍了企业级银河麒麟V10-SP1操作系统的批量部署全流程,包括标准化镜像制作、自动化封装技术、网络化部署方案及UKey集群激活方案。通过实战案例和技术要点解析,帮助企业IT运维团队大幅提升部署效率,确保系统安全与稳定性。

weixin_30729609的博客 391

hdu 题目1398 Square Coins (母函数及其应用)

Square Coins Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6828    Accepted Submission(s): 4613 Problem Description People in Sil

Hanks软件库 1792

SAP中贸易伙伴的应用原理简析

公司也称为贸易伙伴,是出具合并报表的组织单位,可以为客户和供应商分配公司(贸易伙伴),用于识别集团内关闻公司间的业务往来,在编制合并报表时进行往来账务的计算处理。 如下图某贸易伙伴公司(关联方名称G0059)在我方公司的SAP系统中有多重身份(即是供应商,又是客户)。那么在我方公司SAP系统中建立起公司(贸易伙伴),并关联到供应商和客户主数据中。之后,就可以通过G0059这个贸易伙伴名称来识别与该贸易伙伴间的往来业务。 相应的配置设定如下: 定义公司(贸易伙伴或关联方) 会计凭证中会

专注SAP应用技术文章写作,致力于拉近用户与系统间的距离; 9831

hdu-1398 Square Coins

题目地址 hdu1398 题目大意 已知有1 * 1,2 * 2,3 * 3,…17 * 17这17种硬币,给你一个n,问你这十七种硬币凑n的方法有多少种 解题思路 很明显是一个母函数例题。 写出函数: (1 + x1 + … + xn)(1 + x4 + x8 + … + x4*n) … 还是通过循环求出各项相乘后的结果,放入一个数组中。问n有多少种,直接输出xn前面的系数即可。 AC代码 #i...

qq_43227036的博客 154

YOLOv8 模型进化全解析:百种创新模块集成方法与实战部署指南(附资料链接)

动态网络 | DeformableConv/DynamicHead| +2.8% || 轻量化卷积 | GhostConv/MobileConv | +1.2% || 多尺度融合 | AFPN/ASFF | +3.5% || 注意力机制 | CA/EMA/SimAM | +1.8-4.2% |

FJN110的博客 120

WiFi偏门协议(四):增强的传输机制802.11aa

区分Unicast和Multicast的优先级,以及设定不同的重传次数,以细化EDCA机制。 SCS(StreamClassification Service) 如上图,在VI,VO内各自又增加了一个queue, 对应不同的MAC header。VI和VO内的两个queue可以分别对应UC和MC。这样就提供了同一个AC内的更细粒度的优先级区分。当然还可以使用Drop Eligibility Indication子域来区分不同的重传次数。 改善Multicast数据传...

reekyli的专栏 1805

【hdu 1398】 Square Coins

Problem Description People in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (=17^2), i.e.

TLECODE的博客 432

以太网_RGMII接口与GMII接口的转化_03

RGMII接口转GMII接口!

weixin_42499230的博客 383

【HDU1398】Square Coins 母函数

AC通道:http://vjudge.net/problem/HDU-1398 【题意】 给你一个数,让你求出1~17中每个数的平方任意组合,有几种情况满足条件。 【题解】 构造函数f(x)=(1+x+x^2+……)*(1+x^4+x^8+……)*(1+x^9+x^18+……)*…… 然后就是模板了 /************ HDU 1398 by chty 2016

chty_syq的博客 596

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

深度学习工具包 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 1398 Square Coins

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1398 类似hdu 1284  hdu1028 code: #include #include #include #include #include using namespace std; int main() { int n,i,j; int dp[310]; me

u010304217的专栏 1525

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

HDU 1398 —— Square Coins

原题:http://acm.hdu.edu.cn/showproblem.php?pid=1398 #include using namespace std; const int maxn = 1000; int arr[maxn], tmp[maxn]; int n; int main(){ while(cin>>n){ if(n == 0) break;

吧唧吧唧 419

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

HDU-1398 Square Coins

Square Coins Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 14306    Accepted Submission(s): 9834 Problem Description People in Silverland ...

Revenant_Di的博客 276

HDU 1398 Square Coins

母函数简单应用 题目: Square Coins Problem Description People in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbe...

weixin_30415801的博客 132

HDU 1398(Square Coins)

题意:由 17 种硬币价值分别为 1~17 的平方,求组成 价值为 n 的方案数。 分析:生成函数板子题。 代码: #include<cstdio> #include<cstring> #include<iostream> using namespace std; const int N = 301; int a[N],b[N],v[55]...

Joker & Liar的博客 252

hdu1398 Square Coins

Problem Description People in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (=17^2), i.e., 1

450

HDU 1398 Square Coins

HDU_1398     这个题目可以用dp去解,用f[i][j]表示取到i*i这种硬币时面值为j的方案数。     为了练一下生成函数,我就用生成函数的思路写了一下,构造生成函数G(x)=(1+x+x^2+…)(1+x^4+x^8+…)…(1+x^289+x^578+…),然后每次查询相当于查询x^n的系数是多少。 #include&lt;stdio.h&gt;#include&lt;...

weixin_34137799的博客 100

hdu 1398 Square Coins(母函数)

问题描述: People in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (=17^2), i.e., 1-credit coins

u012248410的专栏 908

HDU1398 Square Coins

Description People in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (=17^2), i.e., 1-c...

138

hdu 1398Square Coins

http://acm.hdu.edu.cn/showproblem.php?pid=1398 View Code 1 #include<stdio.h> 2 int main() 3 { 4 int n,i,j,k; 5 int sum[305]; 6 int temp[305]; 7 while(~scanf("%d...

weixin_30556161的博客 70

hdu 1398 Square Coins

母函数水题     #include int c1[301],c2[301]; int main() { int t,n,m,i,j,s,k; while(scanf("%d",&n),n) { for(j=0;j<=n;j++) {c1[j]=1;c2[j]=0;} for(i=2;i<=n;i++)

菜鸟起航的专栏 631
上一篇: HDU - 1028 Ignatius and the Princess III
下一篇: HDU - 1709 The Balance
Xiao____Q
博客等级 码龄11年 38粉丝 217原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值