• LQDOJ
  • Trang chủ
  • Bài tập
  • Bài nộp
  • Thành viên
  • Kỳ thi
  • Nhóm
  • Giới thiệu
    • Máy chấm
    • Khóa học
    • Đề xuất ý tưởng
    • Đề xuất bài tập
    • Tools
    • Báo cáo tiêu cực
    • Báo cáo lỗi

Tiếng Việt

Tiếng Việt
English

Đăng nhập

Đăng ký

nhatduy2286

  • Giới thiệu
  • Bài tập
  • Bài nộp

Rating
-
Bài tập
2
Điểm
1043
Rating #
-
Điểm #
22134

Giới thiệu

include<bits/stdc++.h>

using namespace std;

int main()
{
int n; cin >> n;
int a[10000];

for(int i = 0; i < n; i++)
{
    cin >> a[i];
}

int k = 0; 
int maxx = INT_MIN;
int sum = 0;
while(k < n)
{ 
    sum = 0;
    for(int j = k; j < n; j++)
    {
        sum += a[j];
        if(sum >= maxx)
        {
            maxx = sum;
        }

    }
    k++;
}
cout<<maxx;
return 0;

}


«    »
Thứ 2
Thứ 3
Thứ 4
Thứ 5
Thứ 6
Thứ 7
CN
Ít
Nhiều

proudly powered by DMOJ| developed by LQDJudge team