UVA11158 Elegant Permuted Sum

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=23&page=show_problem&problem=2099 [PDF](https://uva.onlinejudge.org/external/111/p11158.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11158/e2917bcc09b0711af5f4d4041d7842d9c138804b.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11158/670cdc002d2f13b8d0b89cc22cb50aad82998909.png)

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11158/3c44bc437f1893ce726000998da25eac6e197f68.png)