Không hỗ trợ Mobile

Chế độ luyện tập yêu cầu môi trường màn hình lớn để làm bài và chống gian lận hiệu quả. Vui lòng truy cập bằng máy tính (Desktop/Laptop) để tiếp tục thao tác.

Quay lại trang chủ

#1326 · ICPC Training Schedule

In light of the approaching ICPC competition, you have made the decision to revamp your training plan. Recognizing the significance of maintaining both mental and physical stamina, you have allocated a specific number of days, denoted as n, from the remaining n + m days for intensive training. The remaining m days will be dedicated to rest and recovery. The primary objective is to strategize the distribution of training and rest days in a manner that maximizes your ICPC power.

During the training days, you can experience a boost in power, and consecutive training days yield even more substantial results. The power gain from training on the k-th day of consecutive training sessions follows a pattern of 2k - 1, where k = 1 signifies the first day of the training sequence. A single day of training contributes a power increase of 1, while two consecutive training days result in a power boost of 1 + 3 = 4, and three consecutive training days elevate the power by 1 + 3 + 5 = 9.

On the flip side, rest days lead to a reduction in power, and consecutive rest days accelerate this decline. Each day of rest within a sequence of k consecutive rest days diminishes the power by a value of 2k − 1, with k = 1 representing the initial day of the rest sequence. A single day of rest leads to a power reduction of 1, while two consecutive rest days cause a decline of 1 + 3 = 4, and three consecutive rest days result in a reduction of 1 + 3 + 5 = 9.

To maximize the overall increase in your ICPC power over the course of n + m days, it is crucial to devise an optimal training schedule. However, it is important to note that allocating an excessive number of rest days could potentially yield a negative power gain.

Dữ liệu vào

n and m are the numbers of training and repose days, respectively. Neither of them exceeds 10^6, and at least one of them is non-zero.

The end of the input is indicated by a line containing two zeros. The number of datasets does not exceed 100.

Dữ liệu ra

For each of the datasets, output in a line the largest increment of ICPC power after n + m days of training and repose by the best training schedule.

BẢNG TỔNG QUAN KẾT QUẢ

# Tài khoản Kết suất Lúc nộp
1
197 ms 3368 KB
1166 Bytes
23/04/2026
09:09
2
198 ms 8064 KB
1365 Bytes
29/06/2023
16:02
3
224 ms 300 KB
1729 Bytes
23/12/2025
15:30
4
Lê Duy Hải @2280600799
226 ms 296 KB
2669 Bytes
12/08/2025
09:54
5
Lê Duy Hải @2280600799
226 ms 304 KB
2669 Bytes
12/08/2025
09:54
6
Lê Duy Hải @2280600799
227 ms 296 KB
2669 Bytes
12/08/2025
09:54
7
Lê Duy Hải @2280600799
227 ms 300 KB
2669 Bytes
12/08/2025
09:54
8
234 ms 268 KB
1729 Bytes
03/07/2023
15:22
9
235 ms 272 KB
1733 Bytes
30/06/2023
21:28
10
649 ms 300 KB
1654 Bytes
17/10/2025
15:11

LỊCH SỬ CÁ NHÂN

Vui lòng đăng nhập để xem lịch sử làm bài của bạn.

THẢO LUẬN BÀI TOÁN

Chưa có thảo luận nào cho bài này.

Viết code