#2629. 平分数字

平分数字

Description

给定 <math xmlns="http://www.w3.org/1998/Math/MathML">n 个整数:<math xmlns="http://www.w3.org/1998/Math/MathML">a1,a2,,an,请判定能否将它们分成两个部分(不得丢弃任何数字且可以是一部分全部另一部分为空),每部分的数字之和一样大。

Input Format

第一行:单个整数 <math xmlns="http://www.w3.org/1998/Math/MathML">n
第二行:<math xmlns="http://www.w3.org/1998/Math/MathML">n 个整数,表示 <math xmlns="http://www.w3.org/1998/Math/MathML">a1,a2,,an

Output Format

若能否平分,输出 Matched,否则输出 No
4
1 2 3 4
Matched

Hint

输入样例2:

3
2 2 2
输出样例2:

No


  • 对于 <math xmlns="http://www.w3.org/1998/Math/MathML">50% 的数据,<math xmlns="http://www.w3.org/1998/Math/MathML">1n18
  • 对于 <math xmlns="http://www.w3.org/1998/Math/MathML">100% 的数据,<math xmlns="http://www.w3.org/1998/Math/MathML">1n24
  • <math xmlns="http://www.w3.org/1998/Math/MathML">10,000,000ai10,000,000


Source

深搜 上海市2023年2月赛