题意是让你用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. centos7下引导win7

    1.使用root身份(必须)打开 /boot/grub2/grub.cfg 2.找到 ### BEGIN /etc/grub.d/30_os-prober ### 在后面添加 menuentry &q ...

  2. Linux scp命令

    语法 scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit] [-o ssh_option] [-P p ...

  3. php注册数模式

    在前两篇单例模式和工厂模式后,终于迎来了最后一个基础的设计模式--注册树模式. 什么是注册树模式? 注册树模式当然也叫注册模式,注册器模式.之所以我在这里矫情一下它的名称,是因为我感觉注册树这个名称更 ...

  4. MultipartResolver 文件上传

    SpringMVC 中文件上传 MultipartResolver 博客分类: SpringMVC - 基础篇   基于前面文章的基础上. 一.准备 需要的jar  二.配置 1.  spmvc-se ...

  5. 浙大pat1020题解

    1020. Tree Traversals (25) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Suppo ...

  6. 编译搭建Lamp服务器

    Lamp 是目前倍受欢迎的一种网站服务器.其主要有linux+apache+mysql+php 组成.由于其组成成员都是开源免费的产品,所以被作为中小型网站服务器的选择.LZ之前在学校学linux的时 ...

  7. Ansible 变量

    1. 变量来源 inventoryfile中定义 playbook中定义 include文件和角色中定义变量 系统facts  ansible hostname -m setup local fact ...

  8. 输入身份证号码自动读取生日与性别(delphi)

    一.格式介绍: [15位号码格式] 1.第l一6位数为行政区划代码; 2.第7-12位数为出生日期代码; 3.第13---15位数为分配顺序代码; (1).行政区划代码,是指公民第一次申领居民身份证时 ...

  9. HTML5历史管理

    边看视频边做的练习,随机显示数字,分别使用history和hash来实现历史管理 <!doctype html> <html> <head> <meta ch ...

  10. checkbox:全选与反全选

    $(document).ready(function () { //全选checkbox $("#selectAll").click(function () { var check ...