1019

洛谷P1019 题目传送门:传送门p1019注意:本题为上古 NOIP 原题,不保证存在靠谱的做法能通过该数据范围下的所有数据。本题为搜索题,本题不接受 hack 数据。关于此类题目的详细内容NOIP2000 提高组 T3单词接龙是一个与我们经常玩的成语接龙相类似的游戏,现在我们已知一组单词,且给定一个开头的字母,要求出以这个字母开头的最长的“龙”(每个单词都最多在“龙”中出现两次),在两个单词相连时,其重合部分合为一部分,例如 和 ,如果接成一条龙则变为 ,另外相邻的两部分不能存在包含关系,例如 和 间不能相连。输 阅读详情

题意:

在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。
你的任务是,对于给定的N,求出有多少种合法的放置方法。


思路:

就是考虑皇后放置的位置,对于每一行,我们需要枚举每个放置皇后的位置,而且需要判断当前位置是否满足条件,即判断这个位置是否与放置好的前i-1行的皇后的位置相冲突,如果冲突,说明这个位置不合适,否则,就可以枚举下一行皇后的位置,直到第n行。



编写代码:

#include<stdio.h>
#include<string.h>
 int n,tmp;
 int map[11];
 
void DFS(int k)
 {
     int i,j,flag;
     if(k==n+1)
     {
           tmp++;
          return;
     }
     else
     {
          for(i=1;i<=n;++i)
         {
            map[k]=i;
            flag=1;
            for(j=1;j<k;++j)
             {
                 if(map[j]==i||i-k==map[j]-j||i+k==map[j]+j)   
                 {
                     flag=0;
                     break;
                 }
             }
             if(flag)
               DFS(k+1);
        }
     }
 }
 
int main()
 {
     int i,m;
     int ans[11];
     for(n=1;n<=10;++n)
     {
         tmp=0;
         DFS(1);
         ans[n]=tmp;
     }
     while(scanf("%d",&m),m)
     {
         printf("%d\n",ans[m]);
     }
     return 0;
}

AR1019集成电路FM收音机系统设计 AR1019的核心功能主要涵盖了数字音频处理、射频信号接收与解调、以及与外部设备的数据交互等。它具备高效的数据处理能力,能够在保持高保真度音频输出的同时,执行复杂的信号处理任务。在设计FM广播接收系统时,我们的目标是建立一个能够稳定接收FM广播信号,并提供高质量音频输出的系统。为了实现这一点,设计思路遵循了以下原则:高灵敏度:确保系统能够接收较弱的信号。高选择性:区分所需信号和干扰信号。低失真:在音频输出阶段保持信号的真实度。低功耗。 阅读详情

相关推荐

Windows 10/11 安装 HYSPLIT 气象模型全攻略(附必备工具包下载清单)

本文提供了一份详尽的Windows 10/11系统下HYSPLIT气象模型安装与配置全攻略。指南涵盖了从核心认知、必备工具包(Tcl/Tk、ImageMagick)下载,到分步安装、环境变量设置及首次运行验证的完整流程,旨在帮助研究者和学生高效部署这一用于大气轨迹模拟与污染物扩散分析的专业工具。

weixin_28335283的博客 625

HDU-ACM1019

Least Common Multiple Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 44407    Accepted Submission(s): 16662 Problem Description The

Discovering,Thinking and Finding——This Is My Logic 515

STM32+W5500实战:5分钟搞定FreeModbus TCP移植(附完整代码)

本文详细介绍了如何在STM32微控制器上,结合W5500以太网芯片,快速完成FreeModbus TCP协议栈的移植,构建稳定可靠的工业级Modbus TCP服务器。内容涵盖硬件连接、软件架构、驱动适配、核心移植代码实现及调试优化技巧,旨在提供可直接应用于实际项目的完整解决方案。

life6的博客 888

浪在ACM(1019)数的划分

这道题出的很好,可以用很多方法来解答。 令我最深的是动态规划的转移方程。 数的划分这道题说白了就是给你一堆小球,让你将小球分成几堆。 #include<cstdio> using namespace std; int s[205][8]; void dp(int n,int k){ for(int i=1;i<=n;i++) s[i][1]=1; for(int i=2;...

qq_43721152的博客 246

突发环境事件怎么模拟?用Python+GIS实现高斯烟团模型(附完整代码)

本文详细介绍了如何利用Python与GIS技术实现高斯烟团模型,用于模拟化工泄漏等突发环境事件的动态扩散过程。通过核心原理讲解、参数快速获取方案、Python代码实现及GIS可视化集成,为环境应急人员提供了一套完整的解决方案。特别适合危险品运输事故等瞬态污染场景的应急决策支持。

weixin_33692284的博客 490

ROS-Industrial :simple_message

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录1. 概述2. 协议(Protocol)3. HEADER解析3.1 MSG_TYPE3.2 COMM_TYPE3.3 REPLY CODE 1. 概述 Simple_Message是ROS-Industrial的一部分,定义了用于与工业机器人控制器通信的简单消息连接协议。另外还包括处理连接受限系统的处理器和管理器类。 2. 协议(Protocol) 简单消息(simplemessage)协议定义了ROS的驱动层和机器人控制器之.

flsxyw的博客 787

杭电acm1019 hdu-acm-101解题报告

题目链接

yangjing1003004612的专栏 1234

WPF实现圆形菜单动态展开折叠效果

实现效果如下: 思路:根据子菜单个数计算旋转角度动态生成子菜单,并设置展开折叠动画。 步骤: 1、自定义按钮MyButton,建立展示图像属性DisplayImage public class MyButton : Button { public static readonly DependencyProperty DisplayImageProperty = DependencyProperty.Register("DisplayImage", typeof(

dnazhd的博客 3154

ACM-1019

Problem S Time Limit : 15000/5000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 3   Accepted Submission(s) : 2 Problem Description Background Professor Ho

a14772586233的博客 401

Flutter框架GetX从入门到精通第二篇:路由管理-告别繁琐的Navigator

Flutter框架GetX从入门到精通第二篇:告别繁琐的Navigator。本系列将带你从零开始,一步步掌握 GetX 框架的核心功能与实战技巧。

鹏多多的博客 176

5 分钟上手 Kimi Work:安装、配置、跑通第一个任务

这篇文章提供了Kimi Work的快速入门指南,帮助用户在5分钟内完成从安装到运行第一个任务的全过程。主要内容包括: 安装步骤: macOS用户下载.dmg文件并拖入Applications Windows用户下载.exe安装包,需注意中文路径问题 初始设置: 使用现有Kimi账号登录 检查任务配额和文件访问权限 首个任务推荐: 建议从简单的本地文件整理开始(如按类型分类桌面文件) 详细说明了任务执行流程和审批机制 常见问题: 计划生成卡顿的解决方法 文件无变化的排查步骤 进阶建议: 提供难度递增的后续任务

sg_knight的专栏 2874

Codeforces Round 1019

Codeforces Round 1019

青少年趣味编程 1749

二、Creo模型的功能函数 例如:模型(元件)的干涉........

【代码】模型(元件)的干涉。

行为艺术家Zzz的博客 621

1019 数字黑洞

1019 数字黑洞 /** * 1.insert:basic_string& insert( size_type index, size_type count, CharT ch ); * 在index位置插入count个字符ch * 本题中:s.insert(0, 4 – s.length(), ‘0’);用来给不足4位的时候前面补0 * * 2. d...

weixin_38369593的博客 174

VB摄像头监控

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

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

PAT甲级 1019

PAT甲级 1019题目 General Palindromic Number解析代码 题目 General Palindromic Number A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 123432...

qq_37208650的博客 219

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

深入解析WebSocket协议状态码1019

WebSocket协议是HTML5中新增的一种通信协议,相比传统的HTTP协议,具有低延迟、高效率和实时性等优势。WebSocket协议通过在客户端和服务器之间建立持久性的连接,实现全双工的通信方式。在建立连接之后,客户端和服务器可以通过发送消息进行实时的双向通信。客户端发送一个HTTP请求到服务器,请求升级协议为WebSocket。服务器接收到请求后,返回一个HTTP响应,表示升级成功。客户端和服务器之间建立WebSocket连接,可以进行双向通信。

博客 533

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

HZNUOJ 1019 取火柴

HZNUOJ 1019 取火柴 题干: Description 有N根火柴,每次只能取1-4根,请问共有几种取法? 举一个例子,假设有3根火柴,取法有4种,分别为1+1+1,1+2,2+1,3。 Input 第一行包含一个正整数T(0<T<100),表示进行T次测试。接下来有T行,每行只有一个正整数n(1<=n<=66),代表n根火柴。 Output 对于每一个n,输出对应的取法的数量,每次输出占一行。 Samples input Copy 3 1 2 15 output Copy

weixin_48964494的博客 3779

PAT甲级 1019 General Palindromic Number

PAT甲级 1019 General Palindromic Number A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All single...

旺崽的博客 2867

Tongji Online Judge ID:1019

Tongji Online JudgeProblem 1019: 输入三个自然数#include#define print printf("(%d,%d)", k, m)#define endl printf("/n")int main(){        int i, j, k, m, n;        while(scanf("%d%d%d", &n, &i, &j)!=EOF) {    

Merlin的专栏 1037

PAT乙级1019

题目链接 https://pintia.cn/problem-sets/994805260223102976/problems/994805302786899968 题解 根据用户输入或者每次的计算结果,生成大数和小数,然后输出计算过程,一直循环该过程;当结果为0或6174时,循环终止。 刚开始我有一个测试点是没过的,参考了https://blog.csdn.net/qunqunstyl...

weixin_30558305的博客 140

洛谷P1019 单词接龙

预处理+dfs

a free man 796

POJ 1019

/* * poj_1019.c * accepted? */ #include #include /* pow, log10 */ static int poj_1019 (int); int main (int argc, char ** argv){ int i,n; int k,r; scanf ("%d", &n); for (k=0; k<n;

当年小丑 828

poj1019

如题:http://poj.org/problem?id=1019 Number Sequence Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 35225   Accepted: 10140 Description A single positive intege

zht的专栏 496

poj1019——规律题

题目链接:http://poj.org/problem?id=1019 A single positive integer i is given. Write a program to find the digit located in the position i in the sequence of number groups S1S2...Sk. Each group Sk consist...

mumei的博客 1423

PAT B1019数字黑洞

【PAT】B1019 #include <iostream> #include <cstdio> #include <cmath> #include <algorithm> #include <vector> using namespace std; struct digs{ int dig[10]; int len; dig...

飞鱼の博客 336
上一篇: 1011
下一篇: 1004
HerbertWuIsReady
博客等级 码龄11年 6粉丝 73原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值