提交时间:2023-11-04 09:07:12

运行 ID: 108613

# include <bits/stdc++.h> using namespace std ; int cz [114514] = {1} ; int x , tot = 0 ; void splt ( int a , int k ) { for ( int i = cz [k - 1] ; i <= a ; i ++ ) { if ( i < x ) { cz [k] = i ; a -= i ; if ( a == 0 ) { cout << x << '=' ; for ( int j = 1 ; j < k ; j ++ ) { cout << cz [j] << '+' ; } cout << cz [k] << endl ; tot ++ ; return ; } else { splt ( a , k + 1 ) ; } a += i ; cz [k] = 0 ; } } return ; } int main ( ) { cin >> x ; splt ( x , 1 ) ; cout << tot << endl ; return 0 ; }