【山东科技大学OJ】1648. Problem A: 求最大值 您所在的位置:网站首页 uva的全称 【山东科技大学OJ】1648. Problem A: 求最大值

【山东科技大学OJ】1648. Problem A: 求最大值

2023-07-13 05:17| 来源: 网络整理| 查看: 265

 

Time Limit: 1 Sec Memory Limit: 128 MB

Submit: 595 Solved: 334

[Submit][Status]

Description

定义一个类模板Compute,其中有两个重载的静态成员函数getMax,分别用于求2个数的最大值和3个数的最大值。

 

Input

输入有2行,第1行是3个整数,第2行是3个实数。

 

Output

输出有两行,第一行分别输出前2个整数的最大值、所有3个整数的最大值;第二行输出前2个实数的最大值、所有3个实数的最大值。

 

Sample Input

10 20 30

10.11 20.22 -9.99

Sample Output

20 30

20.22 20.22

HINT

Append Code

append.cc,

[Submit][Status]

한국어< 中文 فارسی English ไทย

All Copyright Reserved 2010-2011 SDUSTOJ TEAM

GPL2.0 2003-2011 HUSTOJ Project TEAM

Anything about the Problems, Please Contact Admin:admin

#include

#include

using namespace std;

template

class Compute

{

public:

    static T getMax(T a,T b)

    {

        return a>b?a:b;

    }

    static T getMax(T a,T b,T c)

    {

        return getMax(a,b)>c?getMax(a,b):c;

    }

};

int main(){

    int a,b,c;

    double x,y,z;

    cin>>a>>b>>c;

    cout



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有