Gym - 101142J Java2016 (构造)】的更多相关文章

题意:给定一个数字,让你构造成一些表达式,最后结果是该数字的概率要大于50%. 析:我们可以把一个数分解是2的多少次幂,然后加起来就好. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #include <iostr…
Problem I. Instruction 题目连接: http://codeforces.com/gym/100531/attachments Description Ingrid is a head of a big railway station and, among other duties, is responsible for routing trains to the right platforms. The station has one entrance, and there…
---恢复内容开始--- Monocarp has drawn a tree (an undirected connected acyclic graph) and then has given each vertex an index. All indices are distinct numbers from 11 to nn . For every edge ee of this tree, Monocarp has written two numbers: the maximum ind…
题意:给定一个序列,让你经过不超过9的6次方次操作,变成一个有序的,操作只有在一个连续区间,交换前一半和后一半. 析:这是一个构造题,我们可以对第 i 个位置找 i 在哪,假设 i  在pos 位置,那么如果 (pos-i)*2+i-1 <= n,那么可以操作一次换过来, 如果不行再换一种,如果他们之间元素是偶数,那么交换 i - pos,如果是奇数,交换 i - pos+1,然后再经过一次就可以换到指定位置. 代码如下: #pragma comment(linker, "/STACK:1…
题意:首先你输入一个数字n(偶数)(n<=1000),电脑则自动生成一个长度为n的01字符串,你每次可以构造出一个长度为n的01字符串,输入给电脑后电脑进行判定,如果你的字符串与电脑的字符串完全吻合,电脑返回n,如果只有一半吻合,电脑返回n/2,此外电脑返回0;你最多询问n+500次: #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include…
There is a beautiful fence near Monocarp's house. The fence consists of nn planks numbered from left to right. The ii -th plank has color aiai . Monocarp's father have decided to give his son mm orders. Each order is a color cjcj . After each order M…
K. Perpetuum Mobile Time Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/problem/K Description The world famous scientist Innokentiy almost finished the creation of perpetuum mobile. Its main part is the energy generator which…
Problem H. Hard TestTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100342/attachments Description Andrew is having a hard time preparing his 239-th contest for Petrozavodsk. This time the solution to the problem is based on Di…
Problem A. Alien Communication Masterclass Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100610 Description Andrea is a famous science fiction writer, who runs masterclasses for her beloved readers. The most popular one is the…
H - Football BetsTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87493#problem/H Description While traveling to England, it is impossible not to catch the English passion for football. Almost everyon…