-->
当前位置:首页 > 题库

PROGRAMMING:Finding the largest K primes within N and their sum

Luz5年前 (2021-05-10)题库416
This problem requires computing and outputting the largest K primes not exceeding N and their sum.
###Input format:
Enter the values that give n (10 $$$Le $$n $$$Le $$10000) and K (1 $$$Le $$k $$$Le $$10) in one line.
###Output format:
Output in one line in the following format:
```
Prime 1 + prime 2 +... + prime k = sum value
```
Prime numbers are output in descending order. If n is less than k primes, the output is based on the actual number.
###Input sample 1:
```in
1000 10
```
###Output sample 1:
```out
997+991+983+977+971+967+953+947+941+937=9664
```
###Input sample 2:
```
12 6
```
###Output sample 2:
```
11+7+5+3+2=28
```






answer:If there is no answer, please comment