首页 > 试题广场 >

小乐乐计算函数

[编程题]小乐乐计算函数
  • 热度指数:27318 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 256M,其他语言512M
  • 算法知识视频讲解
小乐乐学会了自定义函数,BoBo老师给他出了个问题,根据以下公式计算m的值。

其中 max3函数为计算三个数的最大值,如: max3(1, 2, 3) 返回结果为3。

输入描述:
一行,输入三个整数,用空格隔开,分别表示a, b, c。


输出描述:
一行,一个浮点数,小数点保留2位,为计算后m的值。
示例1

输入

1 2 3

输出

0.30
头像 viod
发表于 2021-06-07 11:31:03
先定义一个max3()函数返回3个数的最大,然后主函数调用max3()计算: #include<stdio.h> int max3(int a,int b,int c){ if(a>b) b=a; return b>c?b:c; } int main(){ 展开全文
头像 Zerone·
发表于 2022-05-27 18:30:06
">int max3(float a, float b, float c) { if (a >= b && a >= c) return a; else if (b >= a && b >= c) return b; e 展开全文
头像 叶花永不相见
发表于 2022-03-05 20:20:36
#include<stdio.h> int max3(int a, int b, int c) { int max = a; if(max < b) max = b; if(max < c) max = c; r 展开全文
头像 牛客575029355号
发表于 2022-05-18 20:59:05
#include<stdio.h> int max3(int a,int b,int c) {     return a>b? a>c?a:c : b> 展开全文
头像 canwen
发表于 2022-06-14 10:28:14
#2022/6/14 10:27 a,b,c=map(int,input().split()) max1=max(a+b,b,c) max2=max(a,b+c,c) max3=max(a,b,b+c) m=max1/(max2+max3) print("{:.2f}".format(m))
头像 melon.
发表于 2022-12-24 15:13:16
def f(a,b,c): if a > b: max = a else: max = b if max < c: max = c return max nums = input() lst 展开全文
头像 克里里克kliric
发表于 2024-11-23 23:16:43
#include <stdio.h> int max(int x, int y, int z)//最大函数 { int arr[3] = {0}; arr[0] = x; arr[1] = y; arr[2] = z; int i; in 展开全文
头像 new_jytx
发表于 2024-01-02 15:54:41
#include<stdio.h> int max3(a, b, c) { if (a > b && a > c) return a; else if (b > a && b > c) 展开全文
头像 刘肯搏
发表于 2024-10-21 16:47:16
#include <stdio.h> int main() { int max(int a,int b,int c); int a,b,c; scanf("%d %d %d",&a,&b,&c); int x,y 展开全文
头像 宿傩大爷
发表于 2023-11-19 21:19:20
#include <stdio.h> int max3(int a,int b,int c) { int max=a>(b>c?b:c)?a:(b>c?b:c); return max; } int main() { int a,b,c; 展开全文

问题信息

上传者:牛客309119号
难度:
86条回答 3634浏览

热门推荐

通过挑战的用户

查看代码
小乐乐计算函数