Làm (việc) nước

pa_ldk

include <bits/stdc++.h>

using namespace std;
double a,b,s[5];
int main()
{
cin >> a >> b;
for(int i =1 ; i<= 4;i++){
s[1]=a+b;
s[2]=a-b;
s[3]=a*b;
s[4]=a/b;
sort(s+1,s+5,greater<double>());
cout << fixed << setprecision(6) << s[i] << " ";
}
return 0;
}

...Xem thêm

Tổng dãy con

pa_ldk

include <bits/stdc++.h>

using namespace std;
const int N = 1e5 + 5;
int a[N];
int s1(int n) {
int res = 0;
for (int i = 0; i < n; i++) {
if (a[i] > 0) {
res += a[i];
}
}
if(res == 0){
res = *max_element(a, a + n);
}
return res;
}
int s2(int n) {
int s = a[0];
int res = a[0];
for (int i = 1; i < n; i++) {
res = max(a[i], res + a[i]);
s = max(s, res);
}
return s;
}
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
cout << s1(n) << " " << s2(n) << endl;
}
return 0;
}

...Xem thêm

Điền phép tính - Tin học trẻ tỉnh Bắc Giang 2024

PY2GCaoVanAnhKiet

tìm max của a+a,a-a,a:a,a*a rồi if là dc mà

...Xem thêm

Đèn Bình Dương

PY2GCaoVanAnhKiet

bài dễ thở....oxy

...Xem thêm

Những đôi tất khác màu

minhlaiha0

mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

...Xem thêm

LQDOJ Contest #5 - Bài 1 - Trắng Đen

Vodangngoclam

dành cho ai lười suy nghĩ

m,n = map(int,input().split())
if n % 2 == 0 and m % 2 == 0:
    print('trang')
if n % 2 == 1 and m % 2 == 1:
    print('den')
if n % 2 == 1 and m % 2 == 0:
    print('trang')

...Xem thêm

LQDOJ Contest #5 - Bài 1 - Trắng Đen

TDA

if 225 trường hợp là ổn :)))

...Xem thêm

A cộng B

hoangphucnguyen

cho vô ik

...Xem thêm

J4F #04 - Wrong Answer

PY2HPhuHung

you is ok for now?

tuch this

can you AC this problem ?

...Xem thêm

Chia nhóm

nob_Python69

sao testcase chạy sinh lỗi mà mình thử thấy đúng mà nhỉ

...Xem thêm

Cánh diều - TIMBI - Tìm bi (T61)

baokhanh1162013

bài này mình góp ý như sau:

...Xem thêm

KT Số nguyên tố

Viet_osu

tự làm đi bn ơi

...Xem thêm