Codeforces Round #306 (Div. 2) B. Preparing Olympiad

别再手动算K值了!ZEMAX中两种锥透镜建模方法详解(标准面 vs. 轴锥面) 本文详细解析了ZEMAX中锥透镜的两种建模方法:标准面与轴锥面。通过对比两者的精度、计算效率和适用场景,帮助工程师在激光整形、光束匀化等应用中做出最优选择,并提供了参数设置和异常排查的实用技巧。 阅读详情

传送门:http://codeforces.com/problemset/problem/550/B


题意:有n个问题,给出问题的难度值,求问题的组合方式有多少种,要求:

1、最困难题和最简单题的难度值相差不小于x(我用d表示);
2、选出的所有题的难度值的和在l和r之间;

比赛的时候没想到以前讲的DFS例题,用DFS暴力求N个数中选一些数求和。网上好像有用状压做得,没懂。至少要选两题,所以枚举所有两两组合的情况,再DFS暴力搜索所有组合情况。


#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;


int ans;
int n,l,r,d;
int a[20];
void dfs(int id,int ed,int sum,int k)
{
//    printf("%d...\n",sum);
    if(!k&&l<=sum&&sum<=r)
        ans++;
    if(id>ed) return;
    dfs(id+1,ed,sum+a[id],0);
    dfs(id+1,ed,sum,1);
}


int main()
{
    while(scanf("%d%d%d%d",&n,&l,&r,&d)!=EOF)
    {
        for(int i=0;i<n;i++)
            scanf("%d",&a[i]);
        sort(a,a+n);
        ans=0;
        for(int i=0;i<n-1;i++)
        {
            for(int j=i+1;j<n;j++)
            {
                if(a[j]-a[i]>=d)
                {
                    dfs(i+1,j-1,a[i]+a[j],0);
                }
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}

Ceres&OpenCV 单目相机标定(论文复现) 阅读详情

相关推荐

国赛数学建模高教社杯历届优秀论文全集

包含了2004到2023年高教社的赛题及优秀论文。

BanDeng001的博客 3288

Codeforces Round #306 (Div. 2) B

题意给一个长度为n的数组(n<=15)。 从中选出至少两个数,要求满足: ①最大和最小的差不能少于x ②选出的所有数的和在l和r之间思路n太小了。sort一下,然后直接枚举最小和最大值,接着dfs中间剩下的即可,发现一个可行的就cnt++。 注意dfs中使用一个状态参数来说明是否考虑sum的检测,从而避免了used数组。代码#include <cstdio> #include <algori

Bill_Utada的成长之路 1651

CTS实战:如何用set_sense优化时钟树平衡(附ICC2避坑指南)

本文深入探讨了在时钟树综合(CTS)中,如何正确使用`set_sense`命令优化时钟树平衡,并对比了其与`set_disable_timing`的本质区别。通过实战案例详细解析了`-stop_propagation`和`-clock_leaf`参数的应用场景,并提供了ICC2工具中的关键避坑指南,帮助后端工程师精准控制时钟拓扑,避免时序分析漏洞。

weixin_28933797的博客 459

Codeforces Round #306 (Div. 2) A B C

题目链接:http://codeforces.com/contest/550 A 暴力一发。 代码:#include <iostream> #include <stdio.h> #include <math.h> #include <string> #include <string.h> #include <set> #include <map> #include <vector> #incl

mfcheer 872

Python 爬虫实战:抓取新闻网站上的新闻标题和内容

随着信息化的进展,新闻网站已经成为人们获取新闻和时事资讯的主要途径。许多新闻网站提供了丰富的内容,涵盖了社会、政治、科技、娱乐等多个领域。通过抓取新闻网站的内容,我们可以分析新闻的趋势,获取某一领域的最新动态,甚至为数据分析和机器学习提供数据支持。本文将详细介绍如何使用 Python 编写爬虫,抓取新闻网站上的新闻标题和内容。requests:发送 HTTP 请求,获取页面内容。:解析 HTML 页面并提取数据。Selenium:抓取动态加载的网页内容。新闻API。

2201_76125261的博客 3408

2026美赛数学建模竞赛 MCM C题:与星共舞的数据 问题一 粉丝投票估计模型 详细解题思路和代码

2026美赛数学建模竞赛 MCM C题:与星共舞的数据 问题一 粉丝投票估计模型 详细解题思路和代码.。开发一个(或多个)数学模型,用于估算每位选手在他们参赛的各周的粉丝投票数(这是未知且严格保密的)。您的模型是否能正确估算出导致每周淘汰结果一致的粉丝投票数?提供一致性度量。您估算出的粉丝投票总数有多少确定性?这种确定性对于每位选手/每周是否总是相同?为您的估算提供确定性度量。

YOLO 852

Codeforces Round #306 (Div. 2) B. Preparing Olympiad (二进制枚举)

熊希了一下二进制枚举的方法: 1.  利用二进制的开关特性,用1表示元素在集合内,用0表示不在集合内。 2. 可以用 从1到1 例题  : 给出一个集合,求满足条件M的子集的个数。  (M:MAX-MIN>=s  &&  MIN>=l  && MAX #include using namespace std; #define cir(a,b) memset(a,b,sizeof

愿岁月如歌 325

激光雷达点云异常现象详解:鬼影、高反膨胀与拖点

现象核心外观主要成因核心硬件对策核心算法对策鬼影位置错误,出现"复制"的物体镜面反射/光学元件间杂散光物理光阑、抗反射涂层多帧时序一致性检验、反射率逻辑判断膨胀尺寸变大,轮廓呈毛刺状信号饱和、像素/通道串扰可变增益控制、随机编码序列强度阈值滤波、几何轮廓拟合(剪裁)拖点边缘粘连,出现"阶梯"或"连线"光斑跨立边缘、双回波融合小光斑光学设计、多回波支持邻域深度突变检测、波形脉宽分析这些异常现象是当前激光雷达感知中的核心难点,通常需要硬件物理特性优化与上层感知算法。

Fun_LiDAR的博客 304

DFS Codeforces Round #306 (Div. 2) B. Preparing Olympiad

题目传送门 1 /* 2 DFS: 排序后一个一个出发往后找,找到>r为止,比赛写了return ; 3 */ 4 #include <cstdio> 5 #include <iostream> 6 #include <cstring> 7 #include <cmath> 8 #in...

weixin_30642267的博客 134

CDD数据库文件制作(二)——服务配置(0x27)

主要根据诊断调查表,针对0x27服务在CDD中的每一步配置给出详细介绍 1.会话切换配置 1.1.根据诊断调查表进行信息提取 1.2.子功能添加 1.2.1.Level1安全等级1创建 1.2.2.Level3安全等级3创建 1.2.3.安全等级名字查看与修改 1.3.会话切换信息提取(应用程序下) 1.4.会话转换配置(应用程序下) 1.5.会话切换信息提取(引导程序下) 1.6.会话转换配置(引导程序下) 2.安全等级配置信息提取 2.1.安全访问配置(level1) 2.2.安全访问配置(level2

LOVE135149的博客 2930

数据分析案例-电脑笔记本价格数据可视化分析3

本文基于Kaggle笔记本数据集(1303条记录,13个变量),使用Python进行数据可视化分析。通过自定义函数预处理了CPU频率、内存类型等关键特征,利用Seaborn和Matplotlib绘制了品牌分布、内存类型占比、价格影响因素等可视化图表。研究发现:1)Dell和Lenovo市场份额最大;2)SSD是主流存储类型;3)高RAM配置普遍采用SSD;4)Intel处理器占据绝对优势。分析揭示了不同品牌、配置与价格的关系,为消费者购买决策和市场策略制定提供了数据支持。

m0_64336780的博客 1万+

Codeforces Round #306 (Div. 2)——B暴力——Preparing Olympiad

You havenproblems. You have estimated the difficulty of thei-th one as integerci. Now you want to prepare a problemset for a contest, using some of the problems you've made. A problemset f...

dgjm4087的博客 168

CAN 通信测试工具 canutils

概述 CAN,Controller Area Network,控制器局域网,一种高可靠性的现场总线。广泛用于汽车电子、工业控制通信。 canutils 工具包内含 5 个独立的程序:canconfig、candump、canecho、cansend、cansequence。这几个程序的功能简述如下: canconfig:用于配置 CAN 总线接口的参数,主要是波特率和模式。 candump...

一个软件工程师的技术笔记 1万+

Codeforces Round #306 (Div. 2) B.Preparing Olympiad (位运算)

B. Preparing Olympiad time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You have n problems. You have estimat

lljjccsskk的专栏 363

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

深度学习工具包 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&#39;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(&#39;DeepLearnToolbox&#39;));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(&#39;state&#39;,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&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,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 = &#39;sigm&#39;;%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, &#39;Too big error&#39;);```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(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;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)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;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, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% 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&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 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, &#39;Too big error&#39;);```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(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % 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, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % 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, &#39;Too big error&#39;);%% 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(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % 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, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Codeforces Round #306 (Div. 2) B. Preparing Olympiad dfs

题目链接:http://codeforces.com/contest/550/problem/B题意:有n门课,然后让你选择一些课,要求这些课程的和小于等于r,大于等于l,最大值减去最小值至少为x 然后问你有多少种分法题解:数据范围小 n<=15 所以可以把n门课 变成二进制的状态0~(1<代码:dfs ~#include <bits/stdc++.h> using namespace std;

yxg_123的博客 271

VB摄像头监控

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

Codeforces Round #306 (Div. 2)B. Preparing Olympiad--状态压缩

You have n problems. You have estimated the difficulty of the i-th one as integer ci. Now you want to prepare a problemset for a contest, using some of the problems you've made. A problemset fo

qq_21820377的专栏 625

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

codeforces round #306 div2 B Preparing Olympiad && HPU SummerCamp round6 B 二进制枚举

已搬家,请到这里https://jinqimu.github.io/

JQM的博客 461

Codeforces Round #306 (Div. 2) B. Preparing Olympiad (状态压缩)

题意:给你n个数字,挑出任意多个,要求最小和最大的差值不小于x且总和在l和r之间,问有多少种方案思路:由于n极小,那么我们可以直接状态压缩,用二进制表示每个数字的使用状态,然后看是否符合要求即可错误及反思:代码:#include<bits/stdc++.h> using namespace std; const int maxn = 20; long long arr[maxn]; int n; l

Roll_Keyboard的博客 307

hdu5115

传送门:http://acm.hdu.edu.cn/showproblem.php?pid=5115 题意:有一些狼,从左到右排列,每只狼有一个伤害A,还有一个伤害B。杀死一只狼的时候,会受到这只狼的伤害A和这只狼两边的狼的伤害B的和。若两只狼之间的狼都被杀了,这两只狼也算相邻。求杀掉一排狼的最小代价。 思路:区间DP,设f[i][j]为消灭i到j只狼的代价,枚举k作为最后一只

Ac__pyt的专栏 940

hdu 5120

传送门:http://acm.hdu.edu.cn/showproblem.php?pid=5120 题意:求两圆环的相交面积,注意是圆环,运用求两圆相交的模板,推出公式 圆环面积交=大圆大圆面积交-2×大圆小圆面积交+小圆小圆面积交。 #include #include #include #include #define exp 1e-10 #define PI acos(-1.0)

Ac__pyt的专栏 807

hdu 3008 Warcraft

传送门:http://acm.hdu.edu.cn/showproblem.php?pid=3008 题意:需要打一只boss,小明和boss都是每秒攻击一次,但是是小明先攻击boss。小明和boss的血量都是100,小明的普通攻击为1,当然除了普通攻击外,小明还有魔法攻击,小明的魔法量也是100,每次魔法攻击都需要扣除一定量的魔法值,boss的攻击力是固定的为q,小明有n种魔法技能,在

Ac__pyt的专栏 773

CF C. Divisibility by Eight

传送门:http://codeforces.com/problemset/problem/550/C 题意:给出一个不超过100的数字字符串,不含前导零,可以去掉其中任意位子的数字,如果能让剩下的数字组成的数能被8整除,输出YES,否则输出NO 学习了大神的思路,由于1000能被8整除,所以不考虑大于1000的数,因为都是1000的倍数,枚举所有数字,按位子组成3位数,看能否被

Ac__pyt的专栏 675
上一篇: poj 3254 状压DP
下一篇: CF C. Divisibility by Eight
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值