提交时间:2023-08-24 12:38:13
运行 ID: 100019
#include<bits/stdc++.h> using namespace std; int n; int cnt = 0; void hs(int a,int b){ printf("%d=",b); int c = b/(n/2+1); int sum = 0; for(int i = a;i <= b;i++){ if(i != b && i!=a){ sum += c; printf("+%d",c); }else if(i == a){ printf("%d",c); }else{ sum+=c+(b%a); printf("+%d\n",c+(b%a)); cnt++; } } } int main(){ scanf("%d",&n); for(int i = n/2+1;i >= 1;i--){ hs(i,n); } printf("%d",cnt); return 0; }