Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game.

Initially you have a sequence of n integers: 1, 2, ..., n. In a single step, you can pick two of them, let's denote them a and b, erase them from the sequence, and append to the sequence either a + b, or a - b, or a × b.

After n - 1 steps there is only one number left. Can you make this number equal to 24?

Input

The first line contains a single integer n (1 ≤ n ≤ 105).

Output

If it's possible, print "YES" in the first line. Otherwise, print "NO" (without the quotes).

If there is a way to obtain 24 as the result number, in the following n - 1 lines print the required operations an operation per line. Each operation should be in form: "a op b = c". Where a and b are the numbers you've picked at this operation; op is either "+", or "-", or "*"; c is the result of corresponding operation. Note, that the absolute value of c mustn't be greater than 1018. The result of the last operation must be equal to 24. Separate operator sign and equality sign from numbers with spaces.

If there are multiple valid answers, you may print any of them.

Examples

Input
1
Output
NO
Input
8
Output
YES
8 * 7 = 56
6 * 5 = 30
3 - 4 = -1
1 - 2 = -1
30 - -1 = 31
56 - 31 = 25
25 + -1 = 24 题目大意:给你一个n,1-n当中每次选两个数进行运算,进行n-1次运算后要为24,并且用过的数不能再用,新算出的数可以接着用,打印任意一种情况。 思路:n小于4的一定不可以,n等于4和5需要特判,其他情况都可以转化为3-2=1,1-1=0开头,然后用0*i=0(i!=4&&i!=6),最后加个4*6=24就行了。
代码:
 #include<stdio.h>
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
int n;
cin>>n;
if(n<)
cout<<"NO"<<endl;
else if(n==)
{
cout<<"YES"<<endl;
printf("1 * 2 = 2\n");
printf("2 * 3 = 6\n");
printf("4 * 6 = 24\n");
}
else if(n==)
{
cout<<"YES"<<endl;
printf("3 * 5 = 15\n");
printf("2 * 4 = 8\n");
printf("15 + 8 = 23\n");
printf("23 + 1 = 24\n");
}
else
{
cout<<"YES"<<endl;
printf("3 - 2 = 1\n");
printf("1 - 1 = 0\n");
printf("0 * 5 = 0\n");
for(int i=;i<=n;i++)
if(i!=&&i!=)
printf("0 * %d = 0\n",i);
printf("4 * 6 = 24\n");
printf("24 + 0 = 24\n");
}
return ;
}

CodeForces - 468A的更多相关文章

  1. codeforces 468A. 24 Game 解题报告

    题目链接:http://codeforces.com/problemset/problem/468/A 题目意思:给出一个数n,利用 1 - n 这 n 个数,每个数只能用一次,能否通过3种运算: + ...

  2. CodeForces 468A Program F

    Description Little X used to play a card game called "24 Game", but recently he has found ...

  3. [ An Ac a Day ^_^ ] CodeForces 468A 24 Game 构造

    题意是让你用1到n的数构造24 看完题解感觉被样例骗了…… 很明显 n<4肯定不行 然后构造出来4 5的组成24的式子 把大于4(偶数)或者5(奇数)的数构造成i-(i-1)=1 之后就是无尽的 ...

  4. CodeForces - 468A ——(思维题)

    Little X used to play a card game called "24 Game", but recently he has found it too easy. ...

  5. python爬虫学习(5) —— 扒一下codeforces题面

    上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...

  6. 【Codeforces 738D】Sea Battle(贪心)

    http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...

  7. 【Codeforces 738C】Road to Cinema

    http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...

  8. 【Codeforces 738A】Interview with Oleg

    http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...

  9. CodeForces - 662A Gambling Nim

    http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...

随机推荐

  1. static和extern的用法小结

    以前写程序是,基本不管static和extern,一个工程文件也只有一个c文件.今天尝试用多个文件来写,自然就涉及到这两个关键词的使用,自己查了些资料,并且做了些实验,总结如下. extern的用法 ...

  2. OO第二次阶段性总结

    前两次作业我都无效了……用了很久时间但还是没能弄明白多线程的写法,以后还是要学会即时的多问问会的同学吧…… 以及我的Mertrics在挣扎很久之后还是用不了……跪了 第七次作业 第七次作业能够完成的原 ...

  3. 解决:vue项目中多个echarts图表只有最后一个随浏览器变化改变大小

    window.onresize = () => { this.initChart()} 改为 window.addEventListener('resize', () => { this. ...

  4. LeetCode 538 Convert BST to Greater Tree 解题报告

    题目要求 Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the origi ...

  5. python 函数enumerate(x,y)的用法

    enumerate(x,y)函数是把元组tuple.字符串str.列表list里面的元素遍历和索引组合,其用法与range()函数很相似, 下面示例enumerate(x,y)用法以及range(x) ...

  6. P1368 工艺 SA/最小表示法

    正解:SA/最小表示法 解题报告: 传送门! 听说正解是最小表示法,,,O(n)然后常数还挺小的,,, 但是我不会QAQ! 所以先写下SA的做法趴,,,等get了最小表示法再来写正解QAQ 就这种题算 ...

  7. Elasticsearch学习笔记(十四)relevance score相关性评分的计算(1)

    一.多shard场景下relevance score不准确问题     1.问题描述:            多个shard下,如果每个shard包含指定搜索条件的document数量不均匀的情况下, ...

  8. python 判断字符串是否为(或包含)IP地址

    下面是某个字符串是否为IP地址import re def isIP(str): p = re.compile('^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5 ...

  9. node js 爬虫爬取静态页面,

    先打一个简单的通用框子 //根据爬取网页的协议 引入对应的协议, http||https var http = require('https'); //引入cheerio 简单点讲就是node中的jq ...

  10. 小程序报错 TLS 版本必须大于等于 1.2

    https://www.cnblogs.com/phpper/p/6866036.html 服务器是windows 2008 server 环境是IIS7SSL是申请用的阿里免费.微信小程序发现wx. ...