题意是让你用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. [其他]Android SDK离线文件路径以及安装更新方法

    一.离线安装Android SDK文件路径 转载自:http://www.oschina.net/code/snippet_1539302_45940 Google TV Addon, Android ...

  2. openstack私有云布署实践【17 配置文件部份说明】

    Nova部份 cpu_allocation_ratio = 4.0 物理 CPU 超售比例,默认是 16 倍,超线程也算作一个物理 CPU,需要根据具体负载和物理 CPU 能力进行综合判断后确定具体的 ...

  3. [HMLY]3.如何使用Xcode Targets管理开发和生产版本?

    本文原地址:http://www.appcoda.com/using-xcode-targets/ 在开始此教程之前,我们假设你已经完成了应用程序的开发和测试,现在准备提交生产发布.问题是,某些web ...

  4. 转:iOS 屏幕适配,autoResizing autoLayout和sizeClass图文详解

    1. autoResizing autoresizing是苹果早期的ui布局适配的解决办法,iOS6之前完全可以胜任了,因为苹果手机只有3.5寸的屏幕,在加上手机app很少支持横屏,所以iOS开发者基 ...

  5. Java中的native关键字与JNI

    一.先说一下大致的意思: jdk提供的类库源代码中有一些方法没有实现,这些方法前有native关键字,如object类中的 : native Object clone() throws CloneNo ...

  6. X11 基本绘图

    #include <X11/Xlib.h> int main() { Display * dsp = XOpenDisplay(NULL); int screenNum = Default ...

  7. setcookie 设置无效

    转载请署名 achieverain,谢谢 经常见人问PHP程序无法设置cookie.下面把我遇见过的情况都说一遍 1 PHP程序在执行setcookie之前有输出. 解决 :    把setcooki ...

  8. Javascript封装弹出框控件

    1.首先先定义好弹出框的HTML结构 <div class="g-dialog-contianer"> <div class="dialog-windo ...

  9. win8.1和centos6.5 双系统启动问题

    笔记本系统为centos 6.5,由grub引导启动,安装了win 8.1后,开机直接进入win 8.1,没有出现centos6.5 引导项,解决办法: 一.开机按ESC键进入启动顺序菜单,选择cen ...

  10. 一、java自带的观察者模式

    Observer对象是观察者,Observable对象是被观察者. 官网api文档:http://docs.oracle.com/javase/7/docs/api/ 1. 实现观察者模式 实现观察者 ...