传统题 4000ms 128MiB

CNS Paper

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Description

As the light of mathematics, Little A, a member of ACM team, is in love with prime numbers.

Unlike those who do not study in mathematics, Little A has a specific ability, which is that he can duplicate those items numbered by prime numbers.

One day, his tutor accidentally dropped a series of CNS paper that are all unsigned in front of him and coughed a few times...

For each page in the paper has a value, greedy Little A wants to pick up as much value as possible.(Duplicated counts) Please help him.

Input Format

There will be 22 integers N,V(0N104,0V2×104)N,V(0 \le N \le 10^4, 0 \le V \le 2\times 10^4 ), in the first line, denoting the amount of different papers and the space of Little A's hand.

For the following NN line, each line contains 22 integers viv_i and wiw_i , (0vi,wi1000 \le v_i ,w_i \le 100), denoting space cost and value of each page in the specific paper.

Hint: Papers are numbered from 1N1 \to N.

Output Format

Print the maximum value of the papers Little A can get in a single line.

3 10
1 5
2 5
1 1​
26

2023年第五届秋季校赛第二周训练预备赛

未参加
状态
已结束
规则
ACM/ICPC
题目
13
开始于
2023-11-19 13:30
结束于
2023-11-19 18:30
持续时间
5 小时
主持人
参赛人数
17