题意是让你用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. cuda编程(一)

    环境安装和例程运行 显卡主要有两家,ATI.NVIDIA,简称A卡和N卡.随着GPU计算能力的上升,采用GPU并行计算来加速的应用越来越多. Nvidia创立人之一,黄仁勋(Jen-Hsun Huan ...

  2. [读书笔记]python3.5实现socket通讯(UDP)

    UDP连接: 无连接,从一个端向另一端发送独立的数据分组 使用UDP连接的客户-服务器程序: UDPServer.py import socket serverPort = 50009 serverS ...

  3. UVA11549 计算机谜题(Floyd判圈算法)

    #include<iostream> #include<cstdio> #include<cstring> #include<cmath> #inclu ...

  4. Java中集合框架体系

    集合的体系结构:     |--Collection(单列集合的根接口)         |--List(子接口):元素是有序的,元素可以重复.因为该集合体系有索引.             |--A ...

  5. Defraggler(磁盘整理软件) V2.21.993 绿色版

    软件名称: Defraggler(磁盘整理软件) 软件语言: 简体中文 授权方式: 免费软件 运行环境: Win 32位/64位 软件大小: 5.0MB 图片预览: 软件简介: Defraggler ...

  6. Servlet源码初探

    年底,公司的事情告一段落,就来捣鼓一下这个Servlet源码,为下一步的spingmvc源码初探做准备 1.Servlet接口 public interface Servlet { void init ...

  7. CodeForces 671A Recycling Bottles

    暴力. 每个人找到一个入口,也就是从回收站到这个入口走的路程由人的位置到入口的路程来替代. 因此,只要找两个人分别从哪里入口就可以了.注意:有可能只要一个人走,另一人不走. #pragma comme ...

  8. 移动平台下的Socket几个问题

    在页游时代,使用Flash ActionScript 3.0进行开发,as3提供比较简单和健全的socket API.到了手游时代,基于tcp的socket编程遇到了一些棘手的问题.通常情况下手游都要 ...

  9. Action3D

    抖动效果-Shaky3D 波浪效果-Waves3D 翻转效果-FlipX3D 凸镜效果-Ripple3D 液体效果-Liquid 扭动效果-Twirl 破碎效果-ShatteredTiles3D 瓷砖 ...

  10. php干不了的活

    服务端除了web请求,还有很多需要长时间运行的任务在后台执行. 哪些事情是其它语言能做,php做不了的? 有人说,php基本不会成为服务端的瓶颈.事实如此吗? 已知问题:即使在web前端,连接数是ph ...