zoj1136 Code

RT-Thread网络编程:基于STM32F407的TCP客户端实现(含完整代码解析) 本文详细介绍了在STM32F407平台上,基于RT-Thread操作系统和LWIP协议栈实现工业级可靠TCP客户端的完整过程。内容涵盖底层ETH驱动配置、Socket编程、连接保活与断线重连机制、数据收发协议设计以及资源管理,提供了可应用于实际项目的健壮代码框架与调试技巧。 阅读详情

 #include <cstdlib>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>

using namespace std;

struct item{
       string s;
       int r; //modulo n
};

int main(int argc, char *argv[])
{
    int n, m;
    int d[10];
    while (cin>>n)
    {
          cin>>m;
          for (int i=0; i<m; i++)
          {
              cin>>d[i];
          }
          if (n==0){ cout<<0<<endl; continue; }
         
          sort(d, d+m);
          queue<item> Q;
          bool mark[5000];
          memset(mark, false, sizeof(mark));
          for (int i=0; i<m; i++)
          {
              int r = d[i]%n;
              string s;
              if (mark[r]) continue;
              s.append(1, (char) (d[i] + '0'));
              if (s=="0") continue;
             
              mark[r] = true;
              item it = {s, r};            
              Q.push(it);
          }
          bool find = false;
          while (!Q.empty())
          {
                item it = Q.front();
                Q.pop();
                if (it.r == 0){
                   cout<<it.s<<endl;
                   find = true;
                   break;
                }
                for (int i=0; i<m; i++)
                {
                    int r = (it.r*10 + d[i])%n;
                    if (mark[r]) continue;
                    mark[r] = true;
                    string s = it.s;
                    s.append(1, (char) (d[i]+'0'));
                    item tmp = {s, r};                  
                    Q.push(tmp);
                }
          }
          if (!find) cout<<0<<endl;
    }
}

matebookego win11 arm 系统安装安卓子系统 一般的x86电脑如果安装android子系统,运行安卓子系统,由于要将android arm代码转译为x86代码,所以效率不一定高,但是如果电脑是arm架构的,通过安卓子系统运行android的程序执行效率就会 高不少,本文参考,都是在win11 home版本下的。两者跑分在cpu上差不太多了,大约是枭龙855的水平了,这个水平的子系统就有一定的实用性了,玩个一般游戏,刷个抖音都很流畅的。启动子系统后,点击左上角的设置,启用 “开发人员模式”。然后就可以再通运运行华为应用商店来进行安装其它应用了。 阅读详情

相关推荐

ros2笔记-4.6使用launch启动脚本

ros2 4.6 使用launch启动多节点

bohu83的博客 1324

zoj 1136(同余+bfs)

题意:求用m个数字组成n的倍数

一点一滴,从不止步! 1038

Qt Location实战:5分钟搞定地图插件切换与卫星图源加载(附完整代码)

本文是Qt Location开发系列教程的实战指南,详细讲解如何在Qt应用中快速实现地图插件(如Esri、OSM、MapboxGL)的动态切换与卫星图源的加载。通过清晰的代码示例,帮助开发者理解插件机制,解决常见配置问题,并在5分钟内构建出具备交互式地图切换功能的应用程序。

kafka6courier的博客 536

zoj 1136 Multiple(bfs+数论+string)

题意:求N的最小的正整数倍数是否能由给出的M个整数给出。 分析:本题是1530的加强版。先将M个数排序,再广搜之。关键在与根据同余定理判重。凡是被搜过的接点都不必再搜。标记数组的大小不会超过5000因为N 还有的话就是存数,据说longlong能行,但这种题目还是用字符串来做合适点。 学习了下string用法。 #include //1136:关键是剪枝,方法1:运用同余可知

uiiの技术随笔 883

MacOS下Mixly 2.0安装避坑指南:从Java环境到终端权限全解析

本文详细解析了在MacOS系统上安装Mixly 2.0时可能遇到的核心问题与解决方案。针对Java环境版本不兼容、MacOS Gatekeeper安全机制拦截以及终端权限不足三大常见障碍,提供了从检查并配置正确Java版本、安全设置绕过到彻底解决应用内部工具链权限的完整避坑指南,帮助用户顺利完成安装并正常使用。

weixin_29231725的博客 511

腾讯云服务器被攻击,带宽被占满的抗战日记

故事 时间:2021-08-23 地点:腾讯云服务器 事件:服务器内容被黑,修复后某人气不过,开始DDOS,占满服务器的带宽,导致网站访问非常缓慢。 杂记 根据腾讯云后台+宝塔后台,带宽被占满:(小垃圾水管没办法) 部分参考:记一次阿里云服务器ECS流出带宽占满的解决过程 https://blog.csdn.net/wangzhihao1994/article/details/99563456 首先是在云主机上使用远程连接访问到云主机,安装iftop工具 CentOS .

Rudon滨海渔村的博客 1310

ZOJ 1136 Multiple( 搜索 BFS )

题目: 给一个数N,N>= 0, N 解析: 第一,分析可知,由于它是加的位数,而不是数字,所以,对于数一定要有处理,不可能盲目的追加位数! 第二,这m个数,根据题意,可以组成的数字是无穷多的 所以,这里需要一个解决的办法,那就是取余。事实上,任何一个数对n取余,一共只能有n个结果(如果算0的话)。而且有这样的一个式子,如果x%n == y%n, 那么x%n * 10 + c == y%

AClion的专栏 1243

【七.三维视觉与视频分析】【1.点云处理:PointNet++/PointTransformer】

各位老铁,今天咱们要聊的可不是普通的二维图像处理,而是三维视觉领域最硬核的技术——点云处理。从最早的PointNet到如今的PointTransformer,这场技术进化堪比三维版的"像素革命"。今天咱们就深入解剖两大里程碑:PointNet++和PointTransformer,保证让你看完全文就能在点云领域横着走!想象一下,你抓了把沙子撒在空中,每粒沙子的位置都是三维坐标——这就是点云的典型形态。最后送大家一句话:点云处理就像在三维宇宙中寻找星辰的轨迹,既要望远镜的宏观视野,也要显微镜的细致入微。

商务合作|问题讨论|交流学习 请联系作者微信,加微信请务必注明来意,博客主页有联系方式 485

ZOJ 1136

广搜,每个节点有两个值,一个是当前的数字,另一个是余数,用余数可以减少以后的计算量,并且可进行剪枝,从而减少了常数时间的复杂度 #include #include #include #include #include using namespace std; struct Node { string num; int mod; Node() {} Node(stri

For free 1347

超详细的Burp Suite安装使用

‌Burp Suite是一个强大的Web应用安全测试工具,适用于网络安全专业人士进行自动化网络应用程序的安全测试。‌ 它提供了在Windows和Kali Linux上安装和激活Burp Suite Professional的简便步骤,帮助用户快速集成并启用强大的网络扫描和渗透测试功能。Burp Suite的特点包括易于安装、良好的兼容性、内置的自动化工具、优秀的用户体验以及详细的教程,使得无论是安全领域的新手还是经验丰富的专家,都能轻松上手并高效地进行安全测试。此外,Burp Suite还支持扩展功能的使用

Dreams°的博客 2663

AUTOSAR从入门到精通-汽车电子电气架构(EEA)

EEA(Electrical/Electronic Architecture),电子电气架构,是首先由德尔福公司提出的,集合汽车的电子电气系统原理设计、中央电器盒的设计、连接器的设计、电子电气分配系统等设计为一体的整车电子电气解决方案的概念。通过EEA的设计,可将动力总成、驱动信息、娱乐信息等车身信息转化为实际的电源分配的物理布局、信号网络、数据网络、诊断、容错、能量管理等的电子电气解决方案。

getusushu的博客 880

zoj 1136 Multiple

借鉴别人的 主要是需要知道一点: 如果 a%n==b%n 那么根据题目要求只需要对min(a,b)进行继续的添加组合来查找即可! #include<iostream> #include<cstring> #include<algorithm> #include<math.h> #include<vector> #include<set> #include<queue> #include<list> #includ

ZekiDai的博客 233

AI量化学习入门指南:从零开始掌握人工智能投资策略

量化投资:利用数学模型和计算机算法进行投资决策的方法算法交易:自动执行预定义交易规则的系统机器学习:让计算机从数据中学习并改进的技术回测:用历史数据检验交易策略表现的过程特征工程:将原始数据转化为模型可理解的输入过拟合:模型过度适应历史数据,导致未来表现不佳夏普比率:衡量单位风险所获得的超额收益AI量化投资不仅仅是技术的应用,更是一种理性、系统化的投资哲学。它不追求预测市场的每一个拐点,而是通过概率思维和风险管理,在不确定性的市场中寻找统计优势。

AGI×大数据,开启智能时代的认知跃迁;解码AGI,赋能数据驱动的智能革命。 1147

ZOJ 1136 Mutiple (同余定理判重)

1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <algorithm> 5 #include <queue> 6 #define sc(x) scanf("%d",&x) 7 #defin...

dongdui6736的博客 151

vb 6.0并口开发操作实例

vb6并口开发,简体中文,试例内有inpout32.dll动态链接库

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

zoj--题目分类

zoj--题目分类 不知道哪位大虾写的,N多的"简单题" zoj--题目分类 DP: 1011 NTA 简单题 1013 Great Equipment 简单题 1024 Calendar Game 简单题 1027 Human Gene Functions

草莓在努力!!! 1328

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

ZOJ 1136 Multiple BFS 取模 POJ 1465

该题的关键是如果a%n = x; 则(a*10+b)%n == (x*10+b)%n。例如你要算123456789%3,你只需算((12345678%n)*10+9)%3。 想法是把给你的数字先排序,然后扩展,这样能保证你拓展出的数是以递增序列出现的。按示例所示,给你数字1,7,0,你可以拓展出10,11,17;70,71,77; 从拓展出的六个新的数,每个数又能拓展出M(这里的M为3)个。...

weixin_30550081的博客 145

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

zoj浙大acm题目分类整理

DP: 1011 NTA 简单题 1013 Great Equipment 简单题 1024 Calendar Game 简单题 1027 Human Gene Functions 简单题 1037 Gridland 简单题 1052 Algernon\'\'s Noxious Emissions 简单题 1409 Communication System 简单题,但是很容易看错~~

一苇以航 7325

ZOJ 1136 Multiple(分支界限算法)

Multiple Time Limit: 10 Seconds      Memory Limit: 32768 KB a program that, given a natural number N between 0 and 4999 (inclusively), and M distinct decimal digits X1,X2..XM (at least one), f

H煊的博客 876

ZOJ - 1136 Multiple (同余+BFS)

Description a program that, given a natural number N between 0 and 4999 (inclusively), and M distinct decimal digits X1,X2..XM (at least one), finds the smallest strictly positive multiple of N that

那些年 1353

ZOJ1136

比较简单,但被坑了好久,开始没用字符串,直接判定队列首元素大于2000000000,return 0..这题关键还是用mark数组记录余数达到优化。。搓的死,跑了500ms。#include #include #include #include #include #include using namespace std; int n,m; int p[12]; int nu[6000]; stru

终究我要华丽逆袭 1108

ZOJ - 3211 Dream City (贪心+dp)

思路:增长速度快的只有放在后面砍才能获得最大的收益。dp[i][j]表示从前i棵树中选出j棵树, 在前j天砍,砍得顺序就是排序的顺序#include&lt;bits/stdc++.h&gt; using namespace std; const int INF=0x3f3f3f3f; int T; int n, m; int dp[300][300]; pair&lt;int,int&gt; p[...

du_lun的博客 244

zoj 1136 Multiple(数学+bfs)

【题目大意】:给你一个数n,以及m个数字,找一个最小的n的倍数,使得这个数仅由m个数字中的任意个组成。 【解题思路】:易知,a%n=x (a*10+b)%n=(x*10+b)%n。然后bfs扫过去就可以了,注意记录余数,和余数的判重。                             poj要手写queue才能过,不知道为什么 【代码】:

Wu is so Water 1251

ZOJ1136-Multiple—算法7.5 构成指定数字的队列式分支限界算法—C语言模拟队列实现

#include <stdio.h> #include <memory.h> #include <stdlib.h> int cmp(const void * a,const void * b) { return (*(int *)a - *(int *)b); } int n, m; int a[11]; void bfs() { int i, j...

zjutsunny的博客 301
上一篇: zoj1136 Multiple
下一篇: zoj1155 triangle war
yllfever
博客等级 码龄19年 4粉丝 44原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址