HDU4706——Children's Day(简单模拟)

HDU--2104--hide handkerchief--解题报告(辗转相除的运用) Problem DescriptionThe Children’s Day has passed for some days .Has you remembered something happened at your childhood? I remembered I often played a game called hide handkerchief with my friends.N 阅读详情

题目链接:

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

解题思路:

直接模拟就好了。。。

简单的水题。可是我模拟太烂了,没办法,比赛时,为了题数,只好暴力求解了...

AC代码:

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
printf("a e\n");
printf("bdf\n");
printf("c g\n");

printf("h  n\n");
printf("i mo\n");
printf("jl p\n");
printf("k  q\n");

printf("r   z\n");
printf("s  ya\n");
printf("t x b\n");
printf("uw  c\n");
printf("v   d\n");

printf("e    o\n");
printf("f   np\n");
printf("g  m q\n");
printf("h l  r\n");
printf("ik   s\n");
printf("j    t\n");

printf("u     g\n");
printf("v    fh\n");
printf("w   e i\n");
printf("x  d  j\n");
printf("y c   k\n");
printf("zb    l\n");
printf("a     m\n");

printf("n      b\n");
printf("o     ac\n");
printf("p    z d\n");
printf("q   y  e\n");
printf("r  x   f\n");
printf("s w    g\n");
printf("tv     h\n");
printf("u      i\n");

printf("j       z\n");
printf("k      ya\n");
printf("l     x b\n");
printf("m    w  c\n");
printf("n   v   d\n");
printf("o  u    e\n");
printf("p t     f\n");
printf("qs      g\n");
printf("r       h\n");

printf("i        a\n");
printf("j       zb\n");
printf("k      y c\n");
printf("l     x  d\n");
printf("m    w   e\n");
printf("n   v    f\n");
printf("o  u     g\n");
printf("p t      h\n");
printf("qs       i\n");
printf("r        j\n");
return 0;
}

另附两大牛AC代码:

#include <iostream>
#include <cstdio>
using namespace std;

char str[100][100];

int main(){
    int cnt = 0;

    for(int i = 3;i <= 10;i++){
        for(int j = 0;j < i;j++){
            for(int k = 0;k < i;k++)
                str[j][k] = ' ';
            str[j][i] = 0;
        }
        for(int j = 0;j < i;j++){
            str[j][0] = 'a' + cnt;
            cnt = (cnt+1)%26;
        }
        for(int j = i-2;j > 0;j--){
            str[j][i-1-j] = 'a' + cnt;
            cnt = (cnt+1)%26;
        }
        for(int j = 0;j < i;j++){
            str[j][i-1] = 'a' + cnt;
            cnt = (cnt+1)%26;
        }
        for(int j = 0;j < i;j++)
            printf("%s\n",str[j]);
    }

    return 0;
}




#include <stdio.h>
const int N = 26;

int solve(int n, int c){
    int dist = 2 * (n - 1);
    for (int i = 0; i < n; i++){
        for (int j = 0; j < n; j++){
            if (j == 0)
                printf("%c", 'a' + (c + i) % N);
            else if(j == n - 1)
                printf("%c", 'a' + (c + i + dist) % N);
            else if(i + j == n - 1)
                printf("%c", 'a' + (i + c + (n - i - 1) * 2) % N);
            else
                printf(" ");
        }
        printf("\n");
    }
}

int main(){
    int t = 0;
    for (int i = 3; i <= 10; i++){
        solve(i, t);
        t += i * 3 - 2;
    }
    return 0;
}

偏最小二乘结构方程(PLS-SEM)_TomatoSCI分析日记 ①模型整体拟合指标(Goodness-of-Fit, GOF),这个可以看做整体的R方了,上限是1;②指标载荷的具体值;然而,当数据中包含潜变量(即由多个观测指标组合而成的综合概念)时,贝叶斯结构方程不太适用。指标过少(1-2 个)会削弱潜变量的解释力,而指标过多可能增加噪声,影响模型稳定性。如果指标较多,可考虑进一步划分潜变量,但应确保每个指标有意义。掌握这两类方法后,在处理多变量、因果或路径分析研究时,可以根据数据特点与研究需求灵活选择。对于一般的多变量研究,这两类结构方程均为常用且有效的分析方案。 阅读详情

相关推荐

ubuntu18.04 升级Ubuntu 20.04

Ubuntu 18.04升级20.04指南:首先备份重要数据,更新当前系统并检查新版本可用性(sudo do-release-upgrade -c)。确认升级后执行sudo do-release-upgrade,按提示完成操作。升级过程需耐心等待,完成后重启系统。注意:升级前务必备份数据,确保系统为最新版本,以降低风险。升级后即可使用Ubuntu 20.04系统。

https://ophome.blog.csdn.net,在IT行业有多年的工作经验,尤其是在Python、Linux、负载均衡、Nginx和服务器运维等领域。 1068

HDU4706

HDU4706儿童节 题目描述:现在要求输出一个大写的’N’,但是这个N是由从a到z的小写字母构成的,先是一竖,再是一条主对角线,再是一竖。比如大小为3的N是: a e bdf c g 注意:这个N是倒着放的。 输入:无 输出:要求输出大小从3到10的所有‘N’,a-z是按序循环使用的。 分析:所有N都是先一竖(从上到下),再一个副对角线(从左下到右上),再一个竖(从上到下)。Si

u013335937的专栏 595

开源TMS系统cortex-tms私有化部署与二次开发实战指南

运输管理系统(TMS)是现代物流数字化的核心组件,它通过将线下零散的物流操作转化为线上标准化、可追溯的数据流,实现订单、调度、跟踪与结算的全流程管理。其技术原理通常基于微服务架构,采用Spring Boot、Vue.js等成熟技术栈构建,确保系统的稳定性和可扩展性。TMS的技术价值在于显著提升物流企业的运营效率、降低成本并增强过程可控性,尤其适用于中小型物流企业实现从手工管理到系统化管理的跨越。在应用场景上,TMS广泛应用于车队管理、订单跟踪和财务结算等环节。本文聚焦于开源TMS项目cortex-tms,深

weixin_42523907的博客 761

hide handkerchief (gcd)

hide handkerchief The Children’s Day has passed for some days .Has you remembered something happened at your childhood? I remembered I often played a game called hide handkerchief with my friends. N...

codeswarrior的博客 362

用Python对CAPM和Fama French Three Factor model的初步学习

用Python对CAPM和Fama French Three Factor model的初步学习概述介绍建模与分析CAPMFama French Three-Factor Model总结 概述 本文主要使用CAPM(资本资产定价模型)和Fama French Three Factor model来评估中国股票市场的股票价格。 使用CAPM来选择投资组合,然后建立Fama法国三因素模型来评估投资组合...

weixin_43168138的博客 5477

通讯软件013——分分钟学会Kepware OPC AE Server仿真配置

本文介绍如何使用Kepware软件仿真OPC AE Server配置。

zhouwl72的博客 2236

杭电2104hide handkerchief

hide handkerchief Time Limit: 10000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 5252 Accepted Submission(s): 2446Problem Description The Children’s Day

编程小白的进阶之路 888

思科模拟器-实验16:三层交换 VLAN 互访配置

【实验内容】 (1)按实验线路连接图进行连接。按照实验线路连接图分别配置各台计算机IP 地 址。 (2) 按照实验线路连接图,在SW1和SW2上分别完成VLAN配置,并在VLAN中添加相应的端口成员,同时配置Trunk端口。同时测试各计算机之间是否可以相互ping 通。 Switch>en Switch#config t Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#vlan 10 Switc

weixin_44270194的博客 4736

题解

文章目录@[toc]1062 Text Reverse2104 Hide Handkerchief(质数)2734 Quicksum1170 Balloon Comes! 1062 Text Reverse Problem Description Ignatius likes to write words in reverse way. Given a single line of text...

qq330079598的博客 395

DXF转G代码是圆弧的方向如何确定?

🏆本文收录于 《全栈 Bug 调优(实战版)》 专栏。专栏聚焦真实项目中的各类疑难 Bug,从成因剖析 → 排查路径 → 解决方案 → 预防优化全链路拆解,形成一套可复用、可沉淀的实战知识体系。无论你是初入职场的开发者,还是负责复杂项目的资深工程师,都可以在这里构建一套属于自己的「问题诊断与性能调优」方法论,助你稳步进阶、放大技术价值 。

**My Coding Family** 1198

C++(Qt)软件调试---gdb调试入门用法(12)

学习GDB可以帮助程序员更好地调试程序,找到程序中的错误和问题,提高程序的质量和稳定性。 在开发大型软件时,程序中可能存在许多错误和问题,这些问题可能会导致程序崩溃或者出现不可预期的行为。 使用GDB可以帮助程序员更快地找到这些问题,并且提供一些调试工具来帮助程序员更好地理解程序的行为。

mahuifa的博客 5574

【HDU】4706 Children's Day(模拟)

http://acm.hdu.edu.cn/showproblem.php?pid=4706 该题没有输入,直接输出不同形状大小的N,在输出不同形状N的时候是要用到26个字母,并且是循环输出 #include <iostream> using namespace std; char map[60][60]; char a[] = "abcdefghijklmnopqrs...

( :3 ) 243

Claude Code 首次运行:交互式体验与基础命令

自然语言交互:直接用中文或英文描述需求斜杠命令:执行特定功能的快捷方式多轮对话:在上下文中逐步完善代码权限确认:理解并配置安全机制下一篇文章,我们将深入探讨 Claude Code 的核心工具,从文件操作开始,详细了解它是如何处理代码的。

gaoxiang_120的专栏 106

hdu 4706 Children's Day 模拟

 http://acm.hdu.edu.cn/showproblem.php?pid=47061.  这题可以暴力直接printf2. 把printBlank 独立起来可以使代码简洁#include &lt;iostream&gt; using namespace std; void printBlank(int num) { for(int i=0;i&lt;num;i++) ...

加油 (•̀ᴗ•́)و ̑̑ 262

VB摄像头监控

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

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

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

HDU 4706 Children's Day(模拟)

题目链接:HDU 4706 Children's Day 用字母 a - z 画 N , 当z画完,z后面接上a a e bdf c g 规模为3 h n i mo jl p k q 规模为4 只要画出规模为 3 - 10 的 N 即可 。 做了两次这个题目了 , 每次都是直接用printf 画出来 ,也花不了多少时间 这次直接贴一个模拟的代码吧...

weixin_30457881的博客 83

深度学习工具包 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 4706 Children's Day(模拟)

http://acm.hdu.edu.cn/showproblem.php?pid=4706 【题目大意】:   用a-z排出N的形状,输出大小为3-10的N,如果超过z之后,重新从a开始 下面是大小为3的N(其实这里的N是反的,呵呵) a ebdfc g 大小为4的Nh ni mojl pk q 【code】: 1 #include <iostream&g...

diansitao5461的博客 150

HDU 4706 Children's Day(模拟)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4706 Problem Description Today is Children's Day. Some children ask you to output a big letter 'N'. 'N' is constituted by two vertical linesand o...

994

HDU 4706 Children's Day(简单模拟)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4706 题目大意:要用‘a’-‘z’ 26个小写字母输出倒着写得字母'N'的形状,例如  a ebdfc g 就是大小为3的N。输出大小为3-10的所有N的形状,a-z的使用是连续并且周期循环的。 Sample Output a e bdf c g h n i mo jl p ...

weixin_34267123的博客 107

hdu 4706 Children's Day 模拟打印N

题目: AC Code: #include #include #include using namespace std; int main() { char ch[30]="abcdefghijklmnopqrstuvwxyz"; char map[10][10]; int cnt=0; for(int i=3; i<=10; i++) {

a716121的专栏 438

HDU-#4706 Children's Day(模拟)

题目大意:用小写字母输出3至10层的图形,该图形由第一列、最后一列以及对角线构成,要求字符输出是有序的,按照第一列和最后一列从上到下,中间从左到右的顺序。      解题思路:直接就模拟,主要是对下标的控制。解法就是分为三部分,然后每部分枚举下标就可以知道规律,然后进行控制输出即可。注意每一块之间是衔接的,因此要每次输出一块后,要计算下一块的第一个字符的下标。详见code。      题目来源

VoidSun 432

hdu 4706 Children's Day 2013年ICPC热身赛A题 模拟

题意:按字母顺序排列成n型,简单的模拟题。 当字母排到z时从a开始重新排起。 代码: /* * Author: illuz * Blog: http://blog.csdn.net/hcbbt * File: a.cpp * Create Date: 2013-09-08 12:31:36 * Descripton: simulate *

水果君の日常 1909
上一篇: POJ2159——Ancient Cipher
下一篇: POJ2398——Toy Storage
yphacker
博客等级 码龄12年 199粉丝 540原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址