[ An Ac a Day ^_^ ] CodeForces 468A 24 Game 构造
题意是让你用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 构造的更多相关文章
- codeforces 468A. 24 Game 解题报告
题目链接:http://codeforces.com/problemset/problem/468/A 题目意思:给出一个数n,利用 1 - n 这 n 个数,每个数只能用一次,能否通过3种运算: + ...
- CF 468A 24 Game
题目链接: 传送门 24 Game time limit per test:1 second memory limit per test:256 megabytes Description L ...
- CodeForces 468A Program F
Description Little X used to play a card game called "24 Game", but recently he has found ...
- 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 ...
- CodeForces - 468A
Little X used to play a card game called "24 Game", but recently he has found it too easy. ...
- CodeForces - 468A ——(思维题)
Little X used to play a card game called "24 Game", but recently he has found it too easy. ...
- 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, ...
- Codeforces 947F. Public Service 构造
原文链接https://www.cnblogs.com/zhouzhendong/p/CF947F.html 近5K码量构造题,CF血腥残暴! 题解 这里先定义 $FT(k)$ 表示一个菊花树多 k ...
- Codeforces 1071C Triple Flips 构造
原文链接 https://www.cnblogs.com/zhouzhendong/p/CF1071C.html 题目传送门 - CF1071C 题意 给定一个长度为 n 的 01 数列,限定你在 $ ...
随机推荐
- iOS杂货
iOS 导航栏TitleView居中的问题 titleVIew 默认情况下 是居中显示的,出现不居中的情况原因有两个:1,leftBarButtonItem,和rightBarButtonItem 留 ...
- springIOC
从这段代码开始 ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml"); Pers ...
- IIS 发布程序,无法输出EXCEL 问题处理
[解决方案1] 1:在服务器上安装office的Excel软件. 2:在"开始"->"运行"中输入dcomcnfg.exe启动"组件服务&quo ...
- Swift3GCD
GCD的使用在Swift3中的方法 //串行队列 let q:DispatchQueue = DispatchQueue(label: "xiaosi") //并发队列 qos : ...
- 按键精灵http.定义getWeb
Function 取网页源码(URL) Set objXML=CreateObject("Microsoft.XMLHTTP") objXML.Open "Get&quo ...
- SAP HANA studio 创建分析视图
[Step By Step]SAP HANA中创建分析视图(Analytic View) 1. 在Modeler视图中点击新建Analytic View 2. 设置分析视图的属性 Name: 分析视图 ...
- NOIP2010-普及组初赛C语言解析
第十六届全国青少年信息学奥林匹克联赛初赛试题 一.单项选择题 (共20题,每题1.5分,共计30分.每题有且仅有一个正确选项.) 1.2E+03表示( D ). A.2.03 B ...
- Python基础(十)-模块
模块初识 一般把不同功能代码放到不同py文件,一个py文件就是一个模块 三种模块库: 1.Python标准库 2.第三方库 3.自定义库 导入模块:import 库名 (Python解释器只认识执行文 ...
- 2015 QQ最新登录算法
首先还是取得验证码,抓包可得:http://check.ptlogin2.qq.com/check?regmaster=&pt_tea=1&uin=2630366651&app ...
- 【cocos2d-js 3.0】制作2048
2048:在一个4X4的方阵中,玩家需要滑动上面的数字,如果俩个数字相邻并且相等,则相加,需要达到2048,方可胜利. 因为在浏览器操作,所以此例的操作方法为:键盘上的w,s,a,d代表上下左右,也可 ...