浙大PTA 第1章-2 从键盘输入三个数到a,b,c中,按公式值输出 (30 分)

2020.11.22~从键盘输入三个数到a,b,c中,按公式值输出 近日自学Python,偶遇此题,被如何同行输入数据难住,上网查阅后发表在博客上,以资日后查阅。 #在同一行依次输入三个值a,b,c,用空格分开,输出 bb-4a*c的值 #输入 3 4 5 #输出 -44 #AC代码: a,b,c = map(int,input().split(' ')) print(b*b-4*a*c) 其中,input().split(' ')实现了将输入以空格作为分割,而map建立了从字符串到整形的映射。(因为使用input输入的值默认为字符串类型。) ... 阅读详情

在同一行依次输入三个值a,b,c,用空格分开,输出 b*b-4*a*c的值

全题解析链接

浙大Python题目集 PTA95题全部解析


输入格式:

在一行中输入三个数。

输出格式:

在一行中输出公式值。

输入样例:

在这里给出一组输入。例如:

3 4 5

输出样例:

在这里给出相应的输出。例如:

-44

题解: 

a,b,c=input('').split()
a=int(a)
b=int(b)
c=int(c)
print(b*b-4*a*c)

02第1章-2 从键盘输入三个数到a,b,c中,按公式值输出【浙大版《Python 程序设计》题目集】 第1章-2 从键盘输入三个数到a,b,c中,按公式值输出【浙大版《Python 程序设计》题目集】 阅读详情

相关推荐

最新版MySQL 9.0 数据库的下载与安装(图文)

本篇文章基于Windows 10 系统下载与安装MySQL 9.0 版本。

我是聂可的博客 7万+

从键盘输入三个数到a,b,c中,按公式值输出

在同一行依次输入三个值a,b,c,用空格分开,输出 b*b-4*a*c的值 输入格式: 在一行中输入三个数。 输出格式: 在一行中输出公式值。 输入样例: 在这里给出一组输入。例如: 3 4 5 输出样例: 在这里给出相应的输出。例如: -44 a,b,c=map(int,input().split()) sum=b*b-4*a*c print(sum) ...

芝士味椒盐的博客 3373

LEfSe分析避坑指南:如何解决R语言中的常见错误与优化结果可视化

本文提供了R语言中进行LEfSe(线性判别分析)微生物组差异分析的全流程避坑指南。详细解析了从数据格式准备、参数调优(如显著性水平与LDA阈值)、结果可靠性验证到使用ggplot2进行高级可视化的实战技巧,帮助用户规避常见错误,获得更稳健、美观的分析结果。

weixin_29098391的博客 361

第1章-2 从键盘输入三个数到a,b,c中,按公式值输出

在同一行依次输入三个值a,b,c,用空格分开,输出b*b-4*a*c的值。

优快云_Marker的博客 1099

在Ubuntu上通过Wine完美运行企业微信的详细指南

本文提供了在Ubuntu系统上通过Wine兼容层安装和运行企业微信的详细教程。针对官方未提供Linux版本的痛点,指南推荐使用Ubuntu Kylin团队优化打包的Wine环境,通过简单的命令行步骤即可完成部署,并涵盖启动、中文输入法配置、文件管理等常见问题的解决方案,帮助用户实现高效、稳定的办公沟通。

weixin_29306317的博客 229

CANoe: Panel的上位机控制方法

本文介绍了不同于IG的报文控制方法,实现了Panel面板的控制模式。

Jonsnow3zz的博客 1407

PTA 浙大版《Python 程序设计》题目集 第1章-2 从键盘输入三个数到a,b,c中,按公式值输出 (30分)

PTA 浙大版《Python 程序设计》题目集 第1章-2 从键盘输入三个数到a,b,c中,按公式值输出 (30分) 在同一行依次输入三个值a,b,c,用空格分开,输出 bb-4a*c的值 输入格式: 在一行中输入三个数。 输出格式: 在一行中输出公式值。 输入样例: 在这里给出一组输入。例如: 3 4 5 输出样例: 在这里给出相应的输出。例如: -44 方法一 a, b, c = map(int, input().split())//input().split()支持多个数同时输入,再用map把

qq_45831699的博客 523

PyMiMi实战指南:midas_api配置与连接测试详解

本文详细介绍了PyMiMi库中midas_api的配置与连接测试全流程。从环境准备、API密钥获取,到核心的url_cfg配置函数使用,再到通过test_url进行连接验证,提供了清晰的步骤和代码示例。文章重点解析了配置原理、常见错误排查方法(如401错误、连接超时),并强调了API密钥的安全性管理,帮助用户稳固建立Python与Midas Civil NX之间的自动化通信桥梁。

weixin_29044713的博客 691

PTA浙大版python程序设计题目集--第1章-2 从键盘输入三个数到a,b,c中,按公式值输出 (30 分)

在同一行依次输入三个值a,b,c,用空格分开,输出 bb-4a*c的值 输入格式: 在一行中输入三个数。 输出格式: 在一行中输出公式值。 输入样例: 在这里给出一组输入。例如: 3 4 5 输出样例: 在这里给出相应的输出。例如: -44 a,b,c=map(int,input().split()) print(b*b-4*a*c) ...

lwf1881的博客 8224

无人机飞控传感器全解析:从IMU到光流传感器的实战应用

本文深入解析了无人机飞控系统的核心传感器,从IMU、气压计、磁力计到光流传感器,详细阐述了其工作原理、数据融合策略及常见挑战。结合ICF5、Pixhawk 6C等主流飞控硬件,提供了从传感器校准、滤波器调优到应对室内光流定位、强磁干扰等实战场景的系统性优化指南,帮助开发者突破飞控“黑箱”,实现更稳定、可靠的飞行控制。

weixin_28396629的博客 167

Protege新手必看:从安装到建模的完整指南(附推理功能详解)

本文为Protege新手提供从安装、配置到核心建模的完整实战指南。详细讲解了Java环境准备、本体项目创建、类与属性定义、个体填充等关键步骤,并重点解析了推理功能的配置与使用,帮助读者快速构建可逻辑推理的知识图谱,避开常见陷阱。

numpy6sculptor的博客 796

第1章-2 从键盘输入三个数到a,b,c中,按公式值输出 (30分) PTA-python 题解 浙大版《Python 程序设计》题目集

致读者: 博主是一名数据科学与大数据专业大三的学生,一个互联网新人,这篇文章是记录我作为python助教总结的简单题解,写博客一方面是为了记录自己的学习过程中遇到的问题和思考,一方面是希望能够帮助到很多和自己一样处于困惑的读者。 由于水平有限,博客中难免会有一些错误,有纰漏之处恳请各位大佬不吝赐教!之后会写大数据专业的文章哦。 GitHub链接https://github.com/wfy-belief 尽管现在我的水平可能还不太及格,但我会尽我自己所能,做到最好☺。——天地有正气,杂然赋流形。下则为河岳,.

ZZULI_星.夜 1035

企业数字化转型解决方案架构设计:一个五维全景视角

本文系统探讨了企业数字化转型的架构设计框架,提出五维协同模型:企业架构作为战略罗盘,业务架构聚焦价值创造,应用架构实现能力载体,数据架构提供智能燃料,技术架构奠定基础支撑。文章深入分析了各架构域的核心要素、设计原则及相互关系,并指出数字化转型需通过渐进路径,结合战略引领、技术赋能和组织变革,构建有机统一的架构体系。该框架为企业应对数字化复杂性提供了系统性方法论,强调从整体视角实现技术与业务的深度融合。

金牌架构师 1256

第1章-2 从键盘输入三个数到a,b,c中,按公式值输出 (30分)

PTA 浙大版《Python 程序设计》题目集 第1章-2 从键盘输入三个数到a,b,c中,按公式值输出 (30分) 在同一行依次输入三个值a,b,c,用空格分开,输出 bb-4a*c的值 输入格式: 在一行中输入三个数。 输出格式: 在一行中输出公式值。 输入样例: 在这里给出一组输入。例如: 3 4 5 输出样例: 在这里给出相应的输出。例如: -44 a, b, c = map(int, i...

Weary_PJ的博客 2127

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

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

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

浙大Python 第1章-2 从键盘输入三个数到a,b,c中,按公式值输出 (30 分)

原题题目 代码实现 a,b,c = map(int,input().split()) print(b*b - 4*a*c) 提交结果 收获之处 对于一行多个整数或者多个字符串输入 可以用 map(int(input().split()))

Love 6's Private Blog 1059

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

PTA-Python-第1章-2 从键盘输入三个数到a,b,c中,按公式值输出 (30分)

点击链接PTA-Python-AC全解汇总 题目: 在同一行依次输入三个值a,b,c,用空格分开,输出 bb-4a*c的值 输入格式: 在一行中输入三个数。 输出格式: 在一行中输出公式值。 输入样例: 在这里给出一组输入。例如: 3 4 5 输出样例: 在这里给出相应的输出。例如: -44 我的代码: a,b,c=map(int, input().split()) print (b*b-4*a*c) ...

卷子的博客 994

浙大PTA 第2章-12 输出三角形面积和周长 (15 分)

本题要求编写程序,根据输入的三角形的三条边a、b、c,计算并输出面积和周长。注意:在一个三角形中, 任意两边之和大于第三边。三角形面积计算公式:area=√​s(s−a)(s−b)(s−c)​​​,其中s=(a+b+c)/2。 输入格式: 输入为3个正整数,分别代表三角形的3条边a、b、c。 输出格式: 如果输入的边能构成一个三角形,则在一行内,按照 area = 面积; perimeter = 周长 的格式输出,保留两位小数。否则,输出 These sides do not corres

amateur_python的博客 1181

第2章-10 输出华氏-摄氏温度转换表 (15分)

PTA 浙大版《Python 程序设计》题目集 第2章-10 输出华氏-摄氏温度转换表 (15分) 输入2个正整数lower和upper(lower≤upper≤100),请输出一张取值范围为[lower,upper]、且每次增加2华氏度的华氏-摄氏温度转换表。 温度转换的计算公式:C=5×(F−32)/9,其中:C表示摄氏温度,F表示华氏温度。 输入格式: 在一行中输入2个整数,分别表示lowe...

Weary_PJ的博客 1446

PTA浙大版《C语言程序设计》编程题,练习2-1到习题2-6答案

个人建议 初学者还是把格式规范起来,自己读起来既方便又美观 PTA对结果的格式要求很严格,答题的时候注意题目要求 练习2-1 Programming in C is fun! (5 分) 本题要求编写程序,输出一个短句“Programming in C is fun!”。 输入格式: 本题目没有输入。 输出格式: 在一行中输出短句“Programming in C is fun!”。 #include<stdio.h> //调用库 int main(void) { printf("Pro

qq_54388490的博客 1万+

PTA浙大版《Python 程序设计》题目集

本题目集是在2021年初写的,当时受疫情影响,题目集是对所有用户开放的,后来题目集就有权限了,需要购买浙大的Python教材才能用。 题目集记录了我初学Python时的经历,所以前几道题看起来会不符合Python简洁的特性。 初学Python时,没有老师教我,完全就是在自学,所以不会做的题也会上网上搜答案,这就导致题目集中有些题和网上的很相似。 其他题目集: PTA浙大版《C语言程序设计实验与习题指导(第3版)》题目集(参考代码) PTA浙大版《C语言程序设计(第3版)》题目集(参考代码) PTA团体程序设

Re:从零开始的代码生活的博客 7276

PTA 浙大版《Python程序设计》题目集 1-2 从键盘输入三个数到a,b,c中,按公式值输出

在同一行依次输入三个值a,b,c,用空格分开,输出 bb-4a*c的值 输入格式: 在一行中输入三个数。 输出格式: 在一行中输出公式值。 输入样例: 在这里给出一组输入。例如: 3 4 5 输出样例: 在这里给出相应的输出。例如: -44 Python代码: a,b,c = map(int,input().split()) d = b*b- 4*a*c print(d) ...

fxj1126858950的博客 172

PTA-浙大版C语言程序设计(第3版)编程题--C语言--持续更新

练习2-1 Programming in C is fun! 本题要求编写程序,输出一个短句“Programming in C is fun!”。 #include <stdio.h> int main (void) { printf ("Programming in C is fun!"); return 0; } 练习2-3 输出倒三角图案 本题要求编写程序,输出指定的由“*”组成的倒三角图案。 #include <stdio.h> int main() {

FlynnLi的博客 1423

浙大PTA 第2章-10 输出华氏-摄氏温度转换表 (15 分)

输入2个正整数lower和upper(lower≤upper≤100),请输出一张取值范围为[lower,upper]、且每次增加2华氏度的华氏-摄氏温度转换表。 温度转换的计算公式:C=5×(F−32)/9,其中:C表示摄氏温度,F表示华氏温度。 输入格式: 在一行中输入2个整数,分别表示lower和upper的值,中间用空格分开。 输出格式: 第一行输出:"fahr celsius" 接着每行输出一个华氏温度fahr(整型)与一个摄氏温度celsius(占据6个字符宽度,靠右对齐,保留1位小

amateur_python的博客 1209

PTA团体程序设计天梯赛-练习集Level-1(参考代码C语言/Python版)

受个人水平限制,《PTA团体程序设计天梯赛-练习集》中暂时只能把Level-1的题目做出来… 题目号 题目名 L1-001 Hello World L1-002 打印沙漏 L1-003 个位数统计 L1-004 计算摄氏温度 L1-005 考试座位号 L1-006 连续因子 L1-007 念数字 L1-008 求整数段和 L1-009 N个数求和 L1-010 比较大小 L1-011 A-B L1-012 计算指数 L1-013 计算阶乘和

Re:从零开始的代码生活的博客 2万+

浙大pythonpta作业答案_浙大PTA-Python题库 编程题第一章(1-1~1-3)题解

注:第七章只有一道题,因为正则表达式学校尚不要求我就还没看,所以这道题解的链接是另一个大佬的题目列表1-1 从键盘输入两个数,求它们的和并输出本题目要求读入2个整数A和B,然后输出它们的和。输入格式:在一行中给出一个被加数在另一行中给出一个加数输出格式:在一行中输出和值。输入样例:在这里给出一组输入。例如:18-48输出样例:在这里给出相应的输出。例如:-30题解print(eval(input(...

weixin_39531582的博客 1729
上一篇: 浙大PTA 第1章-1 从键盘输入两个数,求它们的和并输出 (30 分)
下一篇: 浙大PTA 第1章-3 输出“人生苦短,我学Python” (10 分)
amateur_python
博客等级 码龄5年 118粉丝 94原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值