Tên đăng nhập Điểm ▾ Bài tập Giới thiệu
26101 150 1
26101 150 1
26101 150 1
26101 150 1
26101 150 1
26101 150 1
26101 150 1
26101 150 1
26101 150 1
26101 150 1
26101 150 1
26101
namdz2k10
Hoàng Đức Khải Nam
150 1

2k10
chx ny
cần ny <1m60

26101 150 1

include<bits/stdc++.h>

define ll long long

define ch char

define str string

define FOR(i, a, b) for(int i = (a); i<= (b); i++)

const int N = 1E6+2;

using namespace std;

ll n, k, a[N];

int main()
{

cin >> n >> k;
FOR(i, 1, n)
{
    cin >> a[i];
}
sort(a + 1, a + n + 1);
int dem = 0, tong = 0;
FOR(i, 1, n-1)
{
    FOR(j, i+1, n)
    {
        if(a[i] <= k && a[j] <= k)
        {
            tong = a[i] + a[j];
            if(tong == k)
            {
                dem++;
                tong = 0;
            }
        }
    }
}

cout << tong << " " << dem;

return 0;

}

26101 150 1
26101 150 1
26101 150 1
26101 150 1
26101 150 1

include <iostream>

include <vector>

include <algorithm>

using namespace std;

const int INF = -1e9;

int main() {
int N, M;
cin >> N >> M;

vector<vector<int>> grid(N + 1, vector<int>(M + 1));
for (int i = 1; i <= N; ++i) {
    for (int j = 1; j <= M; ++j) {
        cin >> grid[i][j];
    }
}

vector<vector<vector<int>>> dp(N + 1, vector<vector<int>>(M + 1, vector<int>(N + 1, INF)));
dp[1][1][1] = 0;

for (int r1 = 1; r1 <= N; ++r1) {
    for (int c1 = 1; c1 <= M; ++c1) {
        for (int r2 = 1; r2 <= N; ++r2) {
            int c2 = r1 + c1 - r2;
            if (c2 < 1 || c2 > M) continue;

            int current_max = INF;
            if (r1 > 1 && r2 > 1) current_max = max(current_max, dp[r1 - 1][c1][r2 - 1]);
            if (r1 > 1 && c2 > 1) current_max = max(current_max, dp[r1 - 1][c1][r2]);
            if (c1 > 1 && r2 > 1) current_max = max(current_max, dp[r1][c1 - 1][r2 - 1]);
            if (c1 > 1 && c2 > 1) current_max = max(current_max, dp[r1][c1 - 1][r2]);

            if (current_max != INF) {
                dp[r1][c1][r2] = current_max + grid[r1][c1];
                if (r1 != r2 || c1 != c2) {
                    dp[r1][c1][r2] += grid[r2][c2];
                }
            }
        }
    }
}

cout << dp[N][M][N] << endl;

return 0;

}

26101 150 1
26101 150 1
26101 150 1
26101 150 1
26101 150 1
26101 150 1
26101 150 1

n=int(input())
t=[]
for i in range(0,n+1):
t.append(i)
print(t)

26126
mttn079cb
CB BDi-LQD Le Ngoc Lam
150 4
26127
ntt_tranhatrang 1038
Trần Hà Trang, AMS
150 1
26128 149 2
26128 149 2
26128 149 2
26128
ICT24B00108
Hoàng Ngọc Hùng
149 2
26128
fpthand
Nguyễn Danh Hà
149 2

26128 149 2
26128 149 2
26128
THTB10
Nguyễn Hồng Hải Đăng
148 2
26128 148 2

Toi la 1 con ga

26128 148 2
26128 148 2
26128 148 2
26128 148 2
26128 148 2
26142 147 2
26143 147 1
26144
mttn110nc
NC QNg Le Thanh Phi
147 4
26145 147 1

include <bits/stdc++.h>

using namespace std;

int n, ans;
int a[100005], L[100005];

int main()
{
cin >> n;
for(int i = 1; i <= n; ++i) cin >> a[i];
for(int i = 1; i <= n; ++i) L[i] = 1;
for(int i = 1; i <= n; ++i)
{
for(int j = 1; j < i; ++j)
{
if(a[i] > a[j]) L[i] = max(L[i], L[j] + 1);
}
}
ans = 1;
for(int i = 1; i <= n; ++i) ans = max(L[i], ans);
int d = 0;
for(int i = 1; i <= n; ++i)
{
if(L[i] == ans) ++d;
}
cout << d;
}

26145 147 1
26147 147 1
26147 147 1
26149
leminhhoang
Le Minh Hoang
147 2
26150 146 1
26150 146 1
26150 146 1
26153
mttn122nc
NC DNo Pham Nhat Quang
145 3
26154 144 2
26155 144 1
26156 144 5
26157 144 2
26157 144 2
26159 144 1
26160 144 2
26161 143 1
26161 143 1
26161 143 1
26164
mttn030cb
CB DL Dao Tuan Dat
143 4
26165 141 2
26166 141 2
26167 140 1
26167 140 1
26167 140 1
26167 140 1
26167 140 1
26167 140 1
26167 140 1
26167 140 1
26167 140 1
26167 140 1

Hoc gioi!

26167 140 1
26167 140 1
26179
mttn074nc
NC NT Pham Dang Khiem
140 3
26180 140 5
26181
mttn142cb
CB TN Do Quang Thanh
139 4
26182 139 2
26182 139 2
26182
A_063
PHAM VU DUY KHOA
139 2
26182
A_099
NGUYEN PHUONG LONG
139 2
26182
A_165
PHAM DUY TAN
139 2
26182
THTB25
Đặng Xuân Minh Khôi
139 2
26182
THTB26
Nguyễn Đăng Khuê
139 2
26182
THTA07
Lê Hoàng Bách
139 2
26182 139 2
26182 139 2
26182 139 2
26182 139 2
26182 139 2
26182 139 2
26182 139 2

Hi

26182 139 2
26182 139 2
26182 139 2
26182 139 2