L1-010 比较大小 (10 分)

浙大版《C语言程序设计(第3版)》题目集 比较大小 习题3-1 比较大小 (10分) 本题要求将输入的任意3个整数从小到大输出。 输入格式: 输入在一行中给出3个整数,其间以空格分隔。 输出格式: 在一行中将3个整数从小到大输出,其间以“->”相连。 输入样例: 4 2 8 输出样例: 2->4->8 解答 int main() { int a, b, c,d; scanf("%d %d %d", &a, &b, &c); if (a > b) { d = a; a = 阅读详情

L1-010 比较大小 (10 分)

本题要求将输入的任意3个整数从小到大输出。

输入格式:

输入在一行中给出3个整数,其间以空格分隔。

输出格式:

在一行中将3个整数从小到大输出,其间以“->”相连。

输入样例:

4 2 8

输出样例:

2->4->8

作者: 杨起帆

单位: 浙江大学城市学院

时间限制: 400 ms

内存限制: 64 MB

代码长度限制: 16 KB


编译器:C++(g++)

 

#include<bits/stdc++.h>
using namespace std;
int main(){
    int a[5],t;
    for(int i=1;i<=3;i++) cin>>a[i];
    for(int i=1;i<3;i++){
        for(int j=i+1;j<=3;j++){
            if(a[i]>=a[j]) {
                t=a[i];
                a[i]=a[j];
                a[j]=t;
            }
        }
    }
    cout<<a[1]<<"->"<<a[2]<<"->"<<a[3];
    
    return 0;
}
 

浙大版《C语言程序设计(第3版)》题目集 习题3-1 比较大小 (10 分) 习题3-1 比较大小 (10 分) 本题要求将输入的任意3个整数从小到大输出。 输入格式: 输入在一行中给出3个整数,其间以空格分隔。 输出格式: 在一行中将3个整数从小到大输出,其间以“->”相连。 输入样例: 4 2 8 输出样例: 2->4->8 #include <stdio.h> int main() { int i,j,temp,a[3]={0,... 阅读详情

相关推荐

L1-010 比较大小 (10分)

本题要求将输入的任意3个整数从小到大输出。 输入格式: 输入在一行中给出3个整数,其间以空格分隔。 输出格式: 在一行中将3个整数从小到大输出,其间以“->”相连。 输入样例: 4 2 8 输出样例: 2->4->8 #include <stdio.h> int main() { int a,b,c,t; scanf("%d%d%d",&a,&b,&c); if(a>b) { t=a; a=b; b=t; } if(a&

qq_45798109的博客 821

实验3-3 比较大小 (10 分)

本题要求将输入的任意3个整数从小到大输出。 输入格式: 输入在一行中给出3个整数,其间以空格分隔。 输出格式: 在一行中将3个整数从小到大输出,其间以“->”相连。 输入样例: 4 2 8 输出样例: 2->4->8 这道题我也不知道怎么想出来的,感觉斗点运气哈哈哈 #include<stdio.h> int main() { int a,b,c,t; scanf("%d %d %d",&a,&b,&c); if.

m0_55137424的博客 1095

PTA刷题记录:L1-010 比较大小 (10分)

L1-010 比较大小 题目要求: 本题要求将输入的任意3个整数从小到大输出。 输入格式: 输入在一行中给出3个整数,其间以空格分隔。 输出格式: 在一行中将3个整数从小到大输出,其间以“->”相连。 输入样例: 4 2 8 输出样例: 2->4->8 解题思路: 因为需要比较的数据只有三个,使用两两比较的方法就可以得出结果。 假设三个变量为 a , b , c 。我们依次两两比较并进行交换。 比较过程: 首先比较 a 和 b 并进行交换(我们交换使得大的数据位于后),此时 b 可能是最

英雄爱吃土豆片的博客 587

分支-07. 比较大小(10)

本题要求将输入的任意3个整数从小到大输出。 输入格式: 输入在一行中给出3个整数,其间以空格分隔。 输出格式: 在一行中将3个整数从小到大输出,其间以“->”相连。 输入样例: 4 2 8 输出样例: 2->4->8 程序:

rabbit8848的专栏 6929

c语言基础:L1-010 比较大小

本题要求将输入的任意3个整数从小到大输出。

Tom_Jerry__的博客 1021

rv1126平台spi屏调试

st7789v2 i2c调试

zuoanyouzhuan_的博客 2037

L1-010 比较大小 (10 分)

L1-010 比较大小 (10 分) 本题要求将输入的任意3个整数从小到大输出。 输入格式: 输入在一行中给出3个整数,其间以空格分隔。 输出格式: 在一行中将3个整数从小到大输出,其间以“->”相连。 输入样例: 4 2 8 输出样例: 2->4->8 using namespace std; int main() { int a; int b; int c; in...

qq_44985985的博客 293

Unity3D 2022版如何一键安装Newtonsoft.Json?最新Package Manager教程

本文详细介绍了在Unity3D 2022及以上版本中,如何通过Package Manager一键安装和配置Newtonsoft.Json(Json.NET)。教程涵盖了从打开Package Manager、搜索并安装正确包源,到验证安装和基础使用的完整流程,旨在帮助开发者以现代化、可靠的方式集成这一强大的JSON处理框架,提升开发效率并规避手动导入的常见问题。

lg888的博客 920

L1-010 比较大小 (10 分)

L1-010 比较大小 (10 分) 本题要求将输入的任意3个整数从小到大输出。 输入格式: 输入在一行中给出3个整数,其间以空格分隔。 输出格式: 在一行中将3个整数从小到大输出,其间以“->”相连。 输入样例: 4 2 8 输出样例: 2->4->8 代码: #include <assert.h> #include <ctype.h> #include...

Foolishman的博客 1657

LinuxCNC开发实战:从安装到EtherCAT配置全解析

本文详细解析LinuxCNC开发实战,从系统安装到EtherCAT总线配置全流程。涵盖实时内核优化、伺服驱动器PDO映射、HAL配置及自定义运动学开发,帮助开发者快速搭建工业级数控系统,提升运动控制精度与稳定性。

rgv234567的博客 352

BurpSuite+安卓模拟器双保险:避开真机抓包限制的完整配置指南

本文详细介绍了如何通过BurpSuite与安卓模拟器(如雷电、夜神)协同工作,绕过真机抓包限制的完整配置指南。从环境准备、网络拓扑配置到证书部署和流量分析,提供了一套高效的解决方案,帮助安全测试人员稳定捕获手机数据包,提升测试效率。

Apple的专栏 438

L1-010 比较大小 (10分)java

L1-010 比较大小 (10分) 本题要求将输入的任意3个整数从小到大输出。 输入格式: 输入在一行中给出3个整数,其间以空格分隔。 输出格式: 在一行中将3个整数从小到大输出,其间以“->”相连。 输入样例: 4 2 8 输出样例: 2->4->8 import java.util.Scanner; import java.util.Arrays; public class Main { public static void main(String[] args)

mudamuda_的博客 441

AI工具如何提升产品经理工作效率

AI工具在现代产品管理中扮演着越来越重要的角色,从需求挖掘到原型设计再到交付物制作,AI技术正在重塑产品经理的工作流程。通过自然语言处理(NLP)和机器学习(ML)技术,AI工具能够自动化处理大量重复性任务,如用户访谈转录、竞品分析、原型生成等,显著提升工作效率。以ChatGPT和Notion AI为例,这些工具可以快速生成结构化分析框架和PRD初稿,将传统需要数小时甚至数天的工作压缩到几分钟内完成。在产品设计阶段,工具如Uizard和Galileo AI能够根据文本描述自动生成可交互原型,大幅缩短设计探索

weixin_29194817的博客 241

天梯赛 L1-010 比较大小 (10分)

L1-010 比较大小 (10分) 本题要求将输入的任意3个整数从小到大输出。 输入格式: 输入在一行中给出3个整数,其间以空格分隔。 输出格式: 在一行中将3个整数从小到大输出,其间以“->”相连。 输入样例: 4 2 8 输出样例: 2->4->8 答案 #include <iostream> #include <algorithm> #inc...

_BANA的博客 294

Qt C++ bridge模式(桥)

Bridge模式使得抽象和实现能够相对独立。 bridge.h #pragma once #include class CImplementor { public: virtual void operateImp() = 0; }; class CRectImplementor : public CImplementor { public: CR

thinkme2010的专栏 1893

筑基篇第9节:CUDA内存管理API进阶

CUDA多维内存管理与零拷贝技术 本文介绍了CUDA中高效处理多维数据的内存管理技术。对于二维数据,使用cudaMallocPitch可确保内存对齐访问,提升75%的带宽利用率;三维数据则通过cudaMalloc3D实现切片对齐。配套的cudaMemcpy2D/3D函数能高效处理数据拷贝。此外,零拷贝内存技术允许内核直接访问主机内存,避免显存拷贝开销。这些技术对图像处理、科学计算等应用至关重要,能显著提升多维数据处理的性能。

PeterPan的博客 81

L1-010 比较大小 (10分)(C语言)

L1-010 比较大小 (10分)(C语言) 本题要求将输入的任意3个整数从小到大输出。 输入格式: 输入在一行中给出3个整数,其间以空格分隔。 输出格式: 在一行中将3个整数从小到大输出,其间以“->”相连。 输入样例: 4 2 8 输出样例: 2->4->8 #include"stdio.h" #include"stdlib.h" void main() { int a[4]; int i,j; scanf("%d%d%d",&a[1],&a[2],&a

qq_39915248的博客 861

java技术专家【面试】Java程序员英语面试整个流程

java技术专家【面试】Java程序员英语面试整个流程

大壮 751

L1-010 比较大小 (10 分)[java]

L1-010比较大小(10分) 本题要求将输入的任意3个整数从小到大输出。 输入格式: 输入在一行中给出3个整数,其间以空格分隔。 输出格式: 在一行中将3个整数从小到大输出,其间以“->”相连。 输入样例: 4 2 8 输出样例: 2->4->8 import java.util.Arrays; import java.util.Scanner...

一名北漂Java程序员的学习记录! 880

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

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

上一篇: L1-009 N个数求和 (20 分)
下一篇: L1-011 A-B (20 分)
黑色吊椅
博客等级 码龄9年 102粉丝 78原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值