纯纯构造题,分成奇数和分成偶数,直接构造出1,2,3,4和1,2,3,4,5的情况,之前的用 i - (i - 1) = 1 1 * 1 = 1来代替就可以了
#include<iostream>
#include<cstdio>#include<string.h>
#include<string>
#include<stack>
#include<set>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<sstream>
#define ll __int64
#define lll unsigned long long
#define MAX 1000009
#define MAXN 2009
#define eps 1e-8
#define INF 0x7fffffff
#define mod 1000000007
#define clr(a) memset(a,0,sizeof(a))
#define clr1(a) memset(a,-1,sizeof(a))
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1
using namespace std;
int main()
{
#ifdef ONLINE_JUDGE
#else
freopen("an.txt","r", stdin);
#endif
int n;
while(~scanf("%d",&n))
{
if(n<4)
{
puts("NO");
}
else
{
puts("YES");
if(n%2==1)
{
for(int i = n; i>=6; i-=2)
{
cout<<i<<" - "<<i-1<<" = 1"<<endl;
cout<<"1 * 1 = 1"<<endl;
}
cout<<"5 - 1 = 4"<<endl;
cout<<"4 - 2 = 2"<<endl;
cout<<"2 * 3 = 6"<<endl;
cout<<"4 * 6 = 24"<<endl;
}
else
{
for(int i = n; i>=5; i-=2)
{
cout<<i<<" - "<<i-1<<" = 1"<<endl;
cout<<"1 * 1 = 1"<<endl;
}
cout<<"1 * 4 = 4"<<endl;
cout<<"2 * 3 = 6"<<endl;
cout<<"4 * 6 = 24"<<endl;
}
}
}
return 0;
}