提交时间:2023-12-02 11:13:01

运行 ID: 113599

# include <bits/stdc++.h> using namespace std ; int a [114514] ; int m ; void dfs ( int cur , int s1 , int s2 ) { if ( cur > m && s1 == s2 ) { cout << "true" << endl ; exit ( 0 ) ; return ; } else if ( cur <= m ) { dfs ( cur + 1 , s1 + a [cur] , s2 ) ; dfs ( cur + 1 , s1 , s2 + a [cur] ) ; } else { return ; } } int main ( ) { cin >> m ; for ( int i = 1 ; i <= m ; i ++ ) { cin >> a [i] ; } sort ( a + 1 , a + m + 1 ) ; dfs ( 1 , 0 , 0 ) ; cout << "false" << endl ; return 0 ; }