Đăng nhập để hỏi chi tiết


Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
// C++
#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int max = a[0];
for (int j = 0; j < n; j++) {
if (a[j] > max) {
max = a[j];
}
}
cout << max;
return 0;
}
# Python
inp = input()
nums = [int (x) for x in inp.split()]
int max = nums[0];
for i in nums:
if (i > max):
max = i
print(max)Hãy giúp mọi người biết câu trả lời này thế nào?
![]()
`***` $\texttt{C++}$
#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
int a[n];
int Mx = -1000000;
for(int i = 1; i <= n; i ++){
cin >> a[i];
Mx = max(Mx, a[i]);
}
cout << Mx;
}
`***` $\texttt{Python}$
n = int(input())
a = [0] * (n + 1)
mx = -1000000
for i in range(1, n + 1):
a[i] = int(input())
mx = max(mx, a[i])
print(mx)
Hãy giúp mọi người biết câu trả lời này thế nào?
![]()
Bảng tin