noj 1059 搬寝室

LCD工程师必看:MIPI DSI的LP/HS模式切换全流程拆解(附高通平台实测) 本文为LCD工程师深度解析MIPI DSI接口中低速(LP)与高速(HS)模式切换的全流程。文章结合高通平台实测波形,从协议状态机、时序关键参数到实战调试案例,系统拆解了模式切换的本质、协同机制及常见问题排查方法,重点阐述了LP模式在低功耗控制与HS模式在高速数据传输中的核心作用与切换时序。 阅读详情

搬寝室
时间限制(普通/Java) : 1000 MS/ 3000 MS 运行内存限制 : 65536 KByte
总提交 : 1275 测试通过 : 169
比赛描述
换寝室是大家都不愿意碰到的事情,不幸的是,可怜的wwm高中大学都遇到了。
室友们有一个不成文的规定,那就是根据自己的学号选择床号。如果某同学的学号是a,并且有0..k-1一共k张床,那么他就会选择a%k号床作为他睡觉的地点。显然,两个人不能睡在一张床上。那么给出所有同学的学号,请你为他们准备一间卧室,使得里面的床的数量最少。

输入
第一行是同学的个数n(1<=n<=5,000);第2到第n+1行是每个同学的学号Si(1<=Si<=1,000,000)。

输出

仅一行,是最少的床的数目。

样例输入
5
4
6
9
10
13

样例输出
8

题目来源
wwm

题目链接:http://acm.njupt.edu.cn/acmhome/problemdetail.do?&method=showdetail&id=1059

解题思路:
这题需要仔细地分析,可以发现数字间余数的规律,比如数字a和数字b,a%k的余数和b%k的余数,如果相同,即 a%k=b%k ,用c来表示余数,则有 a-c是 k 的倍数,b - c 也是k的倍数,因此 | (a-c)-(b-c) | = | a-b | 也是k的倍数 ,因此只要是 |a-b|的约数,都不能作为答案k,否则会出现相同的余数。

代码如下:

#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn=1000000+10;
int a[5005];
int b[maxn],c[maxn];
int main(void)
{
    int n,ans;
    memset(b,0,sizeof(b));
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    sort(a,a+n);
    for(int i=0;i<n;i++)
        for(int j=i+1;j<n;j++)
        {
            int cur=a[j]-a[i];
                b[cur]=1;
        }
    b[1]=1;
    for(int i=2;i<=a[n-1];i++)
    {
        if(!b[i])
        {
            memset(c,0,sizeof(c));
            int p=1;
            for(int j=0;j<n;j++)
            {
                int cur=a[j]%i;
                if(c[cur])
                {
                    p=0;
                    break;
                }
                else
                    c[cur]=1;
            }
            if(p)
            {
                ans=i;
                break;
            }
        }
    }
    printf("%d\n",ans );
}
多个linux系统安装到一块硬盘(Kylin+UOS+ubuntu) 之前写过一篇类似的文档,笔者把kylin和UOS安装在一块硬盘上上一篇的文档地址多个linux系统安装到一块硬盘(Kylin+UOS)_银河麒麟系统和uos安装成双系统-优快云博客本次记录的是三个系统到一块硬件上银河麒麟:Kylin-Desktop-V10-SP1-Release-2107-arm64统信:uniontechos-desktop-20-professional-1050-arm64乌班图:ubuntu-22.04.5-live-server-arm64。 阅读详情

相关推荐

AI重塑运营商CRM:从传统办理到智能推荐的实战经验

本文探讨了AI技术如何重塑运营商CRM系统,从传统办理模式升级为智能推荐平台。文章首先分析了传统CRM系统在产品推荐效率、客户信息录入、业务流程和个性化服务等方面的痛点,提出AI赋能的解决方案。技术架构采用分层设计,包含智能推荐引擎、知识图谱系统和大模型集成三大核心模块。实战案例详细介绍了基于深度学习的智能推荐系统实现,包括用户行为特征提取、产品特征建模、推荐模型训练和实时推荐服务等关键组件代码实现,展示了AI如何提升运营商CRM系统的智能化水平和服务效率。

技术传感器的博客 1048

NOJ1059搬寝室——数论+写法

搬寝室 时间限制(普通/Java):1000MS/3000MS          运行内存限制:65536KByte 总提交:992            测试通过:138 描述 换寝室是大家都不愿意碰到的事情,不幸的是,可怜的wwm高中大学都遇到了。 室友们有一个不成文的规定,那就是根据自己的学号选择床号。如果某同学的学号是a,并且有0..k-1一共k张床,那么他就会选

我的博客 793

UVM对象实例化及覆盖的几种方法

UVM对象实例化的方法有多种,以下以object为例: 1)第一种:直接利用new函数进行实例化 trans t1; t1 = new("t1");//利用new函数进行实例化 2)第二种:uvm_component_registry中提供的方法type_id::create,此种方法也是最常使用的方法 trans t2; t2 = trans::type_id::create("t2",this); 3)第三种:uvm_factory中提供的方法creat_object_by_type trans t

沧月九流的博客 3375

1059 搬寝室

搬寝室 时间限制(普通/Java):1000MS/3000MS          运行内存限制:65536KByte 总提交:962            测试通过:134 描述 换寝室是大家都不愿意碰到的事情,不幸的是,可怜的wwm高中大学都遇到了。 室友们有一个不成文的规定,那就是根据自己的学号选择床号。如果某同学的学号是a,并且有0..k-1一共k张床,那么他就会选择a%k

JustDo的专栏 893

【Attention Is All You Need】Transformer模型精读

Attention Is All You Need》这篇论文奠定了Transformer模型的基础,为深度学习的发展提供了新的方向。Transformer通过自注意力机制和并行化处理显著提升了计算效率和模型性能。然而,Transformer的广泛应用也带来了新的挑战,如计算资源的消耗和对长序列的处理能力等。随着技术的不断发展,研究人员已经提出了诸如Efficient Transformer、Reformer等变种,旨在提升Transformer的效率和适应性。

Lewiz_124的博客 1499

小波变换(Wavelet Transform)原理及介绍

小波变换是一种多分辨率时频分析工具,克服了傅里叶变换无法定位时间信息的缺陷。通过可伸缩平移的母小波,它能同时捕捉信号的高频细节(短时特征)和低频轮廓(整体趋势)。其核心原理是利用不同尺度的小波基与信号进行内积运算,生成时频域系数矩阵。小波变换具有动态分辨率特性,高频部分时间精度高,低频部分频率分辨率好。主要应用包括瞬态事件检测、信号降噪、数据压缩(如JPEG2000)和压缩感知(如快速MRI)。

qq_42758052的博客 5477

HDU 1421 搬寝室

搬寝室 Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 1354Accepted Submission(s): 376 Problem Description 搬寝室是很累的,...

weixin_30770495的博客 263

基于 parallels ubuntu 20.04 LTS (focal) 的ros+px4+gazebo 安装

基于 parallels ubuntu 20.04 LTS (focal) 的ros+px4+gazebo 安装。

weixin_40132006的博客 2239

codeforces 538 B.Quasi Binary(思维题)

B. Quasi Binary time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A number is called quasibinary if its decim

ysCover 1702

lift off工艺为什么常用蒸发的方式镀膜?

电子束蒸发中,蒸发物质从源头直接升华并沿直线路径沉积到晶圆上,它可以避免金属在掩模侧壁的覆盖,只在表面进行沉积。在镀膜结束后,在进行光刻胶剥离时,去胶液无法与光刻胶接触反应,导致光刻胶剥离很困难。欢迎加入我的半导体制造知识星球社区,目前社区有1900人左右。我观察到晶圆厂中lift off工艺,镀膜都是用的电子束蒸发的方式,很少有用磁控溅射的方式,为什么?需要增加撕胶工序,将胶面上覆盖的膜层撕掉,使光刻胶露出,这样才容易剥离。上图为磁控溅射的膜层截面图,去胶液很难突破侧壁膜层,进行反应。

1685

File does not exist: /user/anonymous/.staging/job_1628851608378_6064/报错问题解决

user/admin/.staging/job_1571397171638_0001/job_1571397171638_0001_1.jhist 所以为什么没有下发,这里面jhist,只是被引发的错误,它还不是根本的错误。看到上面错误,我们就可以判断,这是网络问题,然而网络无非是ip地址,防火墙,端口,hosts等。我们正常的hosts是这样的。在回头复盘想想,我们找不到jhist,跟我们的网络问题二者是很难找到关联的,所以大家在遇到问题的时候,一定多排查和思考,而不是看到一个错误,就以为是它的问题。

石榴姐yyds 2169

The 2014 ACM-ICPC Asia Regional Contest Xi'an Site K ast Defence

ProblemK. Last Defence Description Given two integersA and B. Sequence S is defined as follow: • S0 = A • S1 = B • Si = |Si−1 −Si−2| for i ≥ 2 Count the number ofdistinct numbe

ysCover 1131

终于找到了!Ubuntu 虚拟机卡死的终极解决方案(如何解决VMware安装Ubuntu24.04桌面进不去、黑屏、虚拟机卡死、显示不全、屏幕闪烁等问题)

终于找到了!Ubuntu 虚拟机卡死的终极解决方案(如何解决VMware安装Ubuntu24.04桌面进不去、黑屏、虚拟机卡死、显示不全、屏幕闪烁等问题)

XiaoqiangClub的博客 1万+

CSU 1217 奇数个的那个数(异或)

1217: 奇数个的那个数 Time Limit: 2 Sec  Memory Limit: 1 MB Submit: 523  Solved: 120 [Submit][Status][Web Board] Description 给定些数字,这些数中只有一个数出现了奇数次,找出这个数。 Input 每组数据第一行n表示数字个数,1 接下来n行每行一个32位

ysCover 1111

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

计算机控制技术及应用

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

Codeforces Beta Round #34 (Div. 2) C. Page Numbers

C. Page Numbers time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output «Bersoft» company is working on a new version of its

ysCover 1047

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

Codeforces Round #105 (Div. 2) B. Escape

B. Escape time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The princess is going to escape the dragon's cave, and she

ysCover 1010

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

Codeforces Round #313 (Div. 2) C. Gerald's Hexagon(补大三角形)

C. Gerald's Hexagon time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Gerald got a very curious hexagon for his birthda

ysCover 1010

poj 2945 Find the Clones (map+string,hash思维)

Find the Clones Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 7498   Accepted: 2780 Description Doubleville, a small town in Texas, was attacked by the ali

ysCover 928

noj 1052 水王争霸

水王争霸 时间限制(普通/Java) : 1000 MS/ 3000 MS 运行内存限制 : 65536 KByte 总提交 : 182 测试通过 : 87 比赛描述 为了丰富校园网络生活,学校 BBS 举行了一次水王争霸赛。比赛开始后,选手们疯狂灌水,都想争取到水王这个荣誉称号。但学校的 BBS 是如此的不堪一击,才 1e-3 秒就超

ysCover 897

Codeforces Round #200 (Div. 2) C. Rational Resistance(脑洞思维)

C. Rational Resistance time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Mad scientist Mike is building a time machine i

ysCover 877

Codeforces Round #105 (Div. 2) C. Terse princess

C. Terse princess time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output «Next please», — the princess called and cast an es

ysCover 855

Codeforces Round #200 (Div. 2)D. Alternating Current (堆栈)

D. Alternating Current time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Mad scientist Mike has just finished constructi

ysCover 820

Codeforces Round #249 (Div. 2) (模拟)

C. Cardiogram time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In this problem, your task is to use ASCII graphics to p

ysCover 817

UVA onlinejudge 11401 - Triangle Counting

题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2396 题目大意:(这题不好复制过来,就简单说一下题意)输入整数n,从1-n数字中取能构成三角形的三个数,问能得到多少个不同的三角形(不同是指至少有一条边不等)。 Input 5

ysCover 788

hdu 3183 A Magic Lamp

A Magic Lamp Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2954    Accepted Submission(s): 1152 Problem Description Kiki likes trav

ysCover 657
上一篇: noj 1058 Tom and Jerry
下一篇: noj 1079 111...
雨狮子
博客等级 码龄12年 24粉丝 185原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值