So sánh #4

Xem PDF



Dạng bài
Điểm: 10 (p) Thời gian: 1.0s Bộ nhớ: 256M Input: bàn phím Output: màn hình

Tìm số lớn nhất trong 5 số đề cho.

Input

  • Gồm một dòng duy nhất chứa 5 số nguyên lần lượt là \(a, b, c, d, e\) \((0 \leq a, b, c, d, e \leq 10^6)\).

Output

  • Gồm một số duy nhất là số lớn nhất trong 5 số đã cho.

Example

Test 1
Input
1 5 1 2 4
Output
5
Test 2
Input
0 8 2 1 8
Output
8

Bình luận


  • 0
    kietlqt    9:11 a.m. 15 Tháng 9, 2024
    Đây là các code tham khảo của mình
    C++
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
        long long a,b,c,d,e; cin>>d>>e>>c>>a>>b;
        cout<<max({a,b,c,d,e});
    }
    
    Pypy3
    a,b,c,d,e = map(int,input().split())
    mx = a
    if mx < b:
        mx = b
    if mx < c:
        mx = c
    if mx < d:
        mx = d
    if mx < e:
        mx = e
    
    print(mx)
    
    Python 3
    a,b,c,d,e = map(int,input().split())
    mx = a
    if mx < b:
        mx = b
    if mx < c:
        mx = c
    if mx < d:
        mx = d
    if mx < e:
        mx = e
    
    print(mx)
    
    C
    #include <stdio.h>
    int main()
    {
        long long a,b,c,d,e,max;
        scanf("%lld%lld%lld%lld%lld",&a,&b,&c,&d,&e);
        max=a;
        if (b>max) max=b;
        if (c>max) max=c;
        if (d>max) max=d;
        if (e>max) max=e;
        printf("%lld",max);
    }
    
    Pascal
    var a,b,c,d,e,max:int32;
    begin
     readln(a,b,c,d,e);
     max:=a;
     if (max<b) then
     begin
     max:=b;
     end;
      if (max<c) then
      begin
     max:=c;
     end;
      if (max<d) then
      begin
     max:=d;
     end;
     if (max<e) then
     begin
     max:=e;
     end;
     write(max);
    end.
    
    Clang++
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
        long long a,b,c,d,e; cin>>d>>e>>c>>a>>b;
        cout<<max({a,b,c,d,e});
    }