题意是让你用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&…
题目链接:http://codeforces.com/problemset/problem/468/A 题目意思:给出一个数n,利用 1 - n 这 n 个数,每个数只能用一次,能否通过3种运算: +.-.* 使得最后的结果为24. 首先大方向想得是对的,就是用前面尽量连续的数构成24,而后面就通过相互抵消变成0,这样就不会影响到前面算出的结果. 但有两个地方比较致命,所以最终要看着test的数据改--.首先没有留意到 n 个数操作的次数恰好为 n - 1 次!!(之前千辛万苦找到构成24的方法…
题目链接: 传送门 24 Game time limit per test:1 second     memory limit per test:256 megabytes Description Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game. Initially you have a sequenc…
Description Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game. Initially you have a sequence of n integers: 1, 2, ..., n. In a single step, you can pick two of them, let's denote…
A. 24 Game Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/468/problem/A Description Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game. Initially you ha…
Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game. Initially you have a sequence of n integers: 1, 2, ..., n. In a single step, you can pick two of them, let's denote them a and …
Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game. Initially you have a sequence of n integers: 1, 2, ..., n. In a single step, you can pick two of them, let's denote them a and …
#include<stdio.h> #include<string.h> char str[210]; int max[210][52]={0}; int sum(int n,int m); int main(){ int i,k,n,m; max[1][0]=1; max[0][0]=1; for(i=0;i<201;i++) sum(i,i+1); scanf("%d",&n); while(n--){ scanf("%s"…
原文链接https://www.cnblogs.com/zhouzhendong/p/CF947F.html 近5K码量构造题,CF血腥残暴! 题解 这里先定义 $FT(k)$ 表示一个菊花树多 k 个点且这 k 个点都不在菊花的中心上.记 $C(x)$ 表示与 $x$ 直接相连的节点( x 为叶子的时候答案唯一). 例如下面的一棵树就是一个 $FT(4)$ ,其中红色区域的是菊花,多出来的 4 个点在绿色区域. 首先,这两棵树如果有任意一棵是 $FT(0)$ 则一定无解.因为如果有 $FT(0…
原文链接 https://www.cnblogs.com/zhouzhendong/p/CF1071C.html 题目传送门 - CF1071C 题意 给定一个长度为 n 的 01 数列,限定你在 $\left \lfloor \frac n 3 \right \rfloor +12$ 次操作内将所有的数字都变成 0 . 操作定义为:选择三个数 $x,y,z(x<y<z, y-x=z-y)$ ,使得 a[x],a[y],a[z] 翻转 (0 变 1 ,1 变 0) 如果不能完成,那么输出 NO…