Type: Default 1000ms 256MiB

序列

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题意

给定两个正整数 nn, kk。求你求出最大的整数 xx 满足:存在一个整数序列a1,a2,,ana_1, a_2, \dots, a_n 使得

i=1nj=i+1najai=x\sum_{i=1}^{n} \sum_{j=i+1}^{n} |a_j - a_i| =x

xkx \leq k

输入格式

第一行输入 tidtid 第二行输入 nn, kk

输出格式

一个整数 xx 表示满足条件的最大的整数。

输入输出样例

输入 #1

0
3 4

输出 #1

4

输入#2

0
4 29

输出#2

29

【数据范围】

对于所有数据,保证 n,k2×105n, k \leq 2 \times 10^5

测试点编号 nn kk 特殊性质 测试点分值
11 20\leq 20 100\leq 100 1010
22 100\leq 100 1212
33 1000\leq 1000 2828
44 2×105\leq 2\times10^5 5050

暑假集训模拟赛1

Not Attended
Status
Done
Rule
OI
Problem
4
Start at
2025-8-15 14:10
End at
2025-8-15 18:10
Duration
4 hour(s)
Host
Partic.
8