HDOJ2042 不容易系列之二

杭电OJ100题——2042-2045(C++版) 不容易系列之二 Problem Description 你活的不容易,我活的不容易,他活的也不容易。不过,如果你看了下面的故事,就会知道,有位老汉比你还不容易。 重庆市郊黄泥板村的徐老汉(大号徐东海,简称XDH)这两年辛辛苦苦养了不少羊,到了今年夏天,由于众所周知的高温干旱,实在没办法解决牲畜的饮水问题,就决定把这些羊都赶到集市去卖。从黄泥板村到交易地点要经过N个收费站,按说这收费站和徐老汉没... 阅读详情

这道题容易

#include<iostream>
using namespace std;

int main(){
    int n,a,total;
    scanf("%d",&n);
    while(n--){
        total=3;
        scanf("%d",&a);
        for(int i=1;i<=a;i++)
           total=2*(total-1);
        
        printf("%d\n",total);
            }
    return 0;
    }


HDU 不容易系列之二 2042 你活的不容易,我活的不容易,他活的也不容易。不过,如果你看了下面的故事,就会知道,有位老汉比你还不容易。 立即下载

相关推荐

idea 编译打包nacos2.0.3源码,生成可执行jar 包常见问题

idea 编译打包nacos2.0.3源码,生成可执行jar 包常见问题

fyihdg的专栏 1226

HDU-2042 不容易系列之二 伪蟠桃记

不容易系列之二 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6513    Accepted Submission(s): 5140 Problem Description 你活的不容易,我活的不容易,他活的也不容易。不过,如...

weixin_34391445的博客 774

使用 Unity Sentis 和 Compute Shader,det_10g.onnx 进行高效人脸五官定位

在计算机视觉领域,人脸五官定位是一个重要的任务。本文将介绍如何使用 Unity Sentis 和 Compute Shader,结合模型,实现高效的人脸五官定位。我们将详细讲解每一步骤,并提供完整的代码示例。

m0_55632444的博客 2400

hdu递归,递推

目录 蟠桃记 1 折线分割平面 2 不容易系列之一 2 骨牌铺方格 3 不容易系列之(3)——LELE的RPG难题 3 Children’sQueue 3 献给杭电五十周年校庆的礼物 3 钥匙计数之二 3 钥匙计数之一 3 母牛的故事 3 超级楼梯 3 不容易系列之二 3 一只小蜜蜂... 3 阿牛的EOF牛肉串 3 神、上帝以及老天爷 3 不容易系列之(4...

weixin_30537451的博客 283

利用HTML+CSS设计PPT:html-to-pptx实现自动化转换与可编辑输出

在办公自动化和前端开发领域,将网页技术应用于文档生成是一个重要的技术方向。其核心原理在于通过解析HTML/CSS的结构与样式,将其映射为目标文档的原生对象模型。这项技术的价值在于,它能够将Web技术栈强大的布局与样式能力(如Flexbox、CSS Grid)与办公软件(如Microsoft PowerPoint)的广泛兼容性和可编辑性相结合。在实际应用场景中,这种技术特别适合需要快速生成兼具设计感与实用性的演示文稿,例如数据报告、产品发布和营销材料。本文探讨的html-to-pptx项目正是这一思路的工程实

weixin_30652491的博客 492

3D-IC测试挑战与Tessent解决方案解析

3D-IC技术通过硅通孔(TSV)实现芯片垂直堆叠,是延续摩尔定律的关键路径。该技术面临三大核心挑战:KGD标准严苛化要求测试覆盖率达99.5%以上,存储器测试需兼容LPDDR/HBM等多种协议,逻辑堆叠需解决TSV互连的电气特性和时序验证问题。Mentor Tessent平台采用混合测试架构,结合压缩扫描测试(ATPG)和内建自测试(BIST)技术,实现100x测试数据压缩比和99.97%的TSV缺陷检出率。这些创新方案在移动SoC和高性能计算芯片中已获验证,测试时间缩短73%,缺陷逃逸率降低77%。随着

weixin_30621711的博客 378

水题(5)计算题

目录 CSU 1035Max DPS CSU 1040 Round-number CSU 1042 遥控机器人 CSU 1114 平方根大搜索 CSU 1131 Nim-B* Sum (求B进制的异或和) CSU 1155 |a-b| CSU1160 十进制-十六进制 CSU 1163 寒衣调 CSU 1205 Rectangles II CSU 1212 中位数 CSU1215 稳定排序 CSU 1240 低调,低调。(异或找出2个只出现1次...

nameofcsdn的博客 3772

MuJoCo 入门教程(一)

在 MuJoCo 仿真中输入自定义数字有三种方法。首先,可在 XML 中定义全局数字字段。它们有一个名称和一个实数值数组。其次,可以通过特定元素的自定义数组来扩展某些模型元素的定义。具体方法是在 XML 元素大小中设置 nuser_XXX 属性。第三,数组 mjData.userdata 不用于任何 MuJoCo 计算。用户可以在这里存储自定义计算的结果;请记住,所有随时间变化的内容都应存储在 mjData 中,而不是 mjModel 中。自定义文本字段可以保存在模型中。

机器人控制与仿真应用 1万+

不容易系列之二【HDOJ2042】

题目链接 #include<iostream> #include<cstdio> using namespace std; int main(){ int n,s,sum; scanf("%d",&n); while(n--){ scanf("%d",&s); sum=3; while(s--) { s...

姚军 175

Redhawk: dynamic ir drop分析(Clock Buffer Clustering)

在dynamic分析中,ir drop问题多出现在三种情况下,缺power mesh,缺power switch,clock cell过于密集。 前两种情况通过选中具体instance查看min res path都比较容易分析出来,而且大部分问题都出现在channel里,这里不多做赘述。 clock cell过于密集这是观察结果,缺少报告支持,这里分享一下分析方法。 首先,选中压降超过signoff标准的instance,(Results->List of Worst Instance DVD中

m0_61544122的博客 5288

RK3566-预装APP

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档。

qq_24093081的博客 704

[热身题][hdoj_2042]不容易系列之二

// hdoj_2042 不容易系列之二 // 0MS 220K 200 B GCC #include int main(void) { int n, a, x; scanf("%d", &n); while(n--) { x = 3; scanf("%d", &a); while(a--) { x = (x-1)*2; } printf("%d\n",

我的ACM之路 792

RK平台内核“大瘦身”:从4GB到500MB的蜕变之旅

摘要:本文详细介绍了RK平台内核裁剪的完整流程与技术要点。通过对RK3568/RK3588等SoC平台的分析,探讨了从初始4GB内核精简至500MB的具体方法。文章系统阐述了前期硬件环境搭建、软件工具准备、SDK源码获取等准备工作,深入解析了内核模块组成及可裁剪部分,并提供了图形化配置界面的详细操作指南。同时,对编译烧录过程和常见问题解决方案进行了说明,强调了备份和谨慎选择裁剪项的重要性。最后展望了内核裁剪技术在物联网和边缘计算等领域的应用前景,为开发者提供了实用的内核优化参考方案。(148字)

远程部署调试 运行安装 项目调试 二次开发 项目技术新 持续迭代 部分源码免费分享 451

HDOJ 2042 不容易系列之二

不容易系列之二 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 19525    Accepted Submission(s): 15719 Problem Description 你活的不容易,我活的不容易,他活的也

Chunzhen的博客 653

蓝牙模块HM-10手册

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

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

hdoj_2042 不容易系列之二

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2042   //C++代码 #include using namespace std; int main(){ int n,a,i,f[31]; f[0]=3; for(i=1;i<=30;i++) f[i]=2*(f[i-1]-1); cin>>n; while(n--){ cin

永恒国度 665

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

hdoj2042不容易系列之二

Problem Description 你活的不容易,我活的不容易,他活的也不容易。不过,如果你看了下面的故事,就会知道,有位老汉比你还不容易。 重庆市郊黄泥板村的徐老汉(大号徐东海,简称XDH)这两年辛辛苦苦养了不少羊,到了今年夏天,由于众所周知的高温干旱,实在没办法解决牲畜的饮水问题,就决定把这些羊都赶到集市去卖。从黄泥板村到交易地点要经过N个收费站,按说这收费站和徐老汉没什么关系,但

WOLF的博客 415

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

HDOJ 2042 不容易系列之二

Problem Description 你活的不容易,我活的不容易,他活的也不容易。不过,如果你看了下面的故事,就会知道,有位老汉比你还不容易。重庆市郊黄泥板村的徐老汉(大号徐东海,简称XDH)这两年辛辛苦苦养了不少羊,到了今年夏天,由于众所周知的高温干旱,实在没办法解决牲畜的饮水问题,就决定把这些羊都赶到集市去卖。从黄泥板村到交易地点要经过N个收费站,按说这收费站和徐老汉没什么关系,但是事实却令

谙绿Acm 314

HDOJ 2042 不容易系列之二

Problem Description 你活的不容易,我活的不容易,他活的也不容易。不过,如果你看了下面的故事,就会知道,有位老汉比你还不容易。重庆市郊黄泥板村的徐老汉(大号徐东海,简称XDH)这两年辛辛苦苦养了不少羊,到了今年夏天,由于众所周知的高温干旱,实在没办法解决牲畜的饮水问题,就决定把这些羊都赶到集市去卖。从黄泥板村到交易地点要经过N个收费站,按说这收费站和徐老汉没什么关系,但是事实却令

谙忆-陈浩翔 1572

HDOJ2042不容易系列之二笔记

题目地址 个个都说递归,可是我有点抗拒递归。好像递归和递推的差别一个是自顶向下,一个是自下向顶,这道 递归不难,可是这个递归,还是要递归到最底,和递推的差别是什么呢,递推需要打表这个差别? 递归代码 #include &lt;iostream&gt; using namespace std; int Recurse(int n) { if(n == 1) { return 4; } el...

Greatljc的博客 335

2019.1.15HDOJ2042不容易系列之二

题目 Problem-2042不容易系列之二 Problem Description 你活的不容易,我活的不容易,他活的也不容易。不过,如果你看了下面的故事,就会知道,有位老汉比你还不容易。 重庆市郊黄泥板村的徐老汉(大号徐东海,简称XDH)这两年辛辛苦苦养了不少羊,到了今年夏天,由于众所周知的高温干旱,实在没办法解决牲畜的饮水问题,就决定把这些羊都赶到集市去卖。从黄泥板村到交易地点要经过N个收费...

WA制造机的博客 1722

hdoj.2042 不容易系列之二 20140726

不容易系列之二 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 16205    Accepted Submission(s): 13034 Problem Description 你活的不容易,我活的不容易,他活的也

>>--» 唯n1.情缘«--<< 366

hdoj 2042 不容易系列之二 C++

主要思想是:运用一个递归函数实现#include<iostream> using namespace std;int num(int n) { if(n==0) return 3; else return 2*(num(n-1)-1);}int main() { int n,a; cin>>n; while (n--)

HDOJ_lin的博客 2679

Jupyter Notebook集成Google Gemini:AI辅助编程环境部署与实战指南

在人工智能与编程工具深度融合的背景下,大语言模型(LLM)正通过代码生成、解释和调试能力重塑开发工作流。其核心原理是基于海量代码和文本数据训练,通过自然语言理解将开发者意图转化为可执行代码或技术解答。这一技术价值在于显著降低编程门槛、加速原型开发与学习过程,尤其适用于数据分析、机器学习建模和教育等场景。本文聚焦于将Google Gemini大模型与Jupyter Notebook环境深度集成,通过API调用实现智能代码补全、错误修复和数据分析辅助,为开发者提供沉浸式AI编程体验。项目中涉及的Gemini A

ithome 480

HDOJ 2042 不容易系列之二 超详细

HDOJ 2042 不容易系列之二 Problem Description 你活的不容易,我活的不容易,他活的也不容易。不过,如果你看了下面的故事,就会知道,有位老汉比你还不容易。 重庆市郊黄泥板村的徐老汉(大号徐东海,简称XDH)这两年辛辛苦苦养了不少羊,到了今年夏天,由于众所周知的高温干旱,实在没办法解决牲畜的饮水问题,就决定把这些羊都赶到集市去卖。从黄泥板村到交易地点要经过N个收费站,按说这收费站和徐老汉没什么关系,但是事实却令徐老汉欲哭无泪: (镜头回放) 近景:老汉,一群羊 远景:公路,收费

qascetic的博客 207
上一篇: HDOJ2037 今年暑假不AC (经典的贪心问题)
下一篇: HDOJ2043 密码
何必纠结于ID
博客等级 码龄14年 65粉丝 64原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值