题意是让你用1到n的数构造24

看完题解感觉被样例骗了……

很明显 n<4肯定不行

然后构造出来4 5的组成24的式子

把大于4(偶数)或者5(奇数)的数构造成i-(i-1)=1

之后就是无尽的24*1=24了

不过……6好像不太对劲……

 #include<stdio.h>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string.h>
#include<string>
#include<map>
#include<set>
#include<vector>
#include<queue>
#define M(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
int main(){
int n;
scanf("%d",&n);
if(n<){
puts("NO");
return ;
}
else{
puts("YES");
if(n%){
puts("3 + 4 = 7");
puts("7 + 5 = 12");
puts("12 * 2 = 24");
puts("24 * 1 = 24");
}
else{
puts("1 * 2 = 2");
puts("2 * 3 = 6");
puts("6 * 4 = 24");
}
for(int i=n;i>;i-=){
printf("%d - %d = 1\n",i,i-);
puts("24 * 1 = 24");
}
}
return ;
}
/* 1 8 */

[ An Ac a Day ^_^ ] CodeForces 468A 24 Game 构造的更多相关文章

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

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

  2. CF 468A 24 Game

    题目链接: 传送门 24 Game time limit per test:1 second     memory limit per test:256 megabytes Description L ...

  3. CodeForces 468A Program F

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

  4. Codeforces Round #268 (Div. 1) A. 24 Game 构造

    A. 24 Game Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/468/problem/A D ...

  5. CodeForces - 468A

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

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

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

  7. NYOJ-655 光棍的YY AC 分类: NYOJ 2013-12-29 19:24 224人阅读 评论(0) 收藏

    #include<stdio.h> #include<string.h> char str[210]; int max[210][52]={0}; int sum(int n, ...

  8. Codeforces 947F. Public Service 构造

    原文链接https://www.cnblogs.com/zhouzhendong/p/CF947F.html 近5K码量构造题,CF血腥残暴! 题解 这里先定义 $FT(k)$ 表示一个菊花树多 k ...

  9. Codeforces 1071C Triple Flips 构造

    原文链接 https://www.cnblogs.com/zhouzhendong/p/CF1071C.html 题目传送门 - CF1071C 题意 给定一个长度为 n 的 01 数列,限定你在 $ ...

随机推荐

  1. 在python上获得随机字符

    """今天写一个程序,在想既然可以获得随机数,那我可不可以获得任意字符呢,于是在stackoverflow.com 上找到了方法,几乎都是用导入random,然后再用其它 ...

  2. webservices(一)

    ---完全摘自网络 什么是webService WebService,顾名思义就是基于Web的服务.它使用Web(HTTP)方式,接收和响应外部系统的某种请求.从而实现远程调用.  1:从WebSer ...

  3. MyBatis 学习-动态 SQL 篇

    MyBatis 为我们提供了如下几个动态 SQL 元素: if choose foreach where/set trim 一.IF 元素 <select id="selectProj ...

  4. 使用 voluptuous 校验数据

    在 Python 中,我们经常需要对参数进行校验,这是我们有好多种方法,例如写很多 if 啊,或者写正则表达式啊等等,技巧高的人可以写得很巧妙,而技巧一般的人呢,可能会写得很冗长,例如我,经常就不能很 ...

  5. java实现线性表

    /** * 线性表 * @author zyyt * */ public  class LinkList {//框架级别的大师级 private int size;//链表的实际大小 private ...

  6. Java:注解(Annotation)自定义注解入门

    转载地址:http://www.cnblogs.com/peida/archive/2013/04/24/3036689.html 要深入学习注解,我们就必须能定义自己的注解,并使用注解,在定义自己的 ...

  7. IBM Minus One

    IBM Minus One Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total ...

  8. MocorDroid编译工程快速建立编译环境

    function sprdLunch(){    declare -a arrProj    arrProj=`find out/target/product -name previous_build ...

  9. UIDatePicker 时间滚动表

    UIDatePicker *datapicker; //时间滚动表 datapicker = [[UIDatePicker alloc]initWithFrame:CGRectMake(50, 200 ...

  10. svn checkout操作

    svn checkout https://svn.com/svn/project 该操作从svn服务器上拉代码下来,并且建立本地和远端的文件对应,状态的关联. 1,和export的区别 svn检出操作 ...