Alice's present Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=95030#problem/A Description As a doll master, Alice owns a wide range of dolls, and each of them has a number tip on it's back, the tip…
 Alice's present Description As a doll master, Alice owns a wide range of dolls, and each of them has a number tip on it's back, the tip can be treated as a positive integer. (the number can be repeated). One day, Alice hears that her best friend Mar…
河蟹王国 Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 https://vijos.org/p/1659 Description 河蟹王国有一位河蟹国王,他的名字叫羊驼.河蟹王国富饶安定,人们和谐相处.有一天,羊驼国王心血来潮,想在一部分人中挑出最和谐的人.于是,羊驼国王将 他的子民排成了一列(==!!b汗~好长呀).每个人都有一个初始的和谐值.羊驼国王每次会选择一个区间[L,R],这个区间中和谐值最大的人就是国王选 出的人.而且,在某一时间,区间[L…
3n+1问题 Time Limit: 2000/1000ms (Java/Others) Problem Description: 考虑如下的序列生成算法:从整数n开始,如果n是偶数,把它除以2:如果 n 是奇数,把它乘3加1.用新得到的值重复上述步骤,直到 n = 1 时停止.例如,n = 22 时该算法生成的序列是: 22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1 .人们猜想(没有得到证明)对于任意整数 n,该算法总能终止于 n = 1.这个猜想对于至少…
题目链接 题意 : 玩台球.Alice 和 Bob,一共可以进行m次,Alice 先打.有一个白球和n个标有不同标号的球,称目标球为当前在桌子上的除了白球以外的数值最小的球,默认白球的标号为0.如果白球落入洞中,要把白球拿出来放在桌子上,如果是其他的球就不拿哪怕是犯规打进去的.每打一局(每一局代表每人打一杆)时当发生以下三种行为时算是犯规,会将相应的罚分加给对方,自己不减分. 白球没有打中任何球.将目标球的数值加到对方的分数上. 白球没有入洞且至少打中一个球,一开始没有打中目标球或者一开始同时打…
题目链接: HDU:http://acm.hdu.edu.cn/showproblem.php?pid=4791 ZJU:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5072 Problem Description Alice is providing print service, while the pricing doesn't seem to be reasonable, so people using her pr…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=5289 题意:给定长度为n的序列a和一个整数K,找出最大值和最小值的差值小于K的区间.输出满足条件的区间的个数. 分析:枚举a[i],以a[i]为起点,然后二分找终点(大区间满足条件的话小区间肯定也满足),依据起点和终点的位置能够算出以a[i]为起点可满足条件的区间的个数.怎么推断区间是否满足条件?能够用st算法用O(N*logN)方法进行预处理,然后O(1)查询区间最大值可最小值.先前用线段树查询超时了…
题目链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3757 #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<vector> #include<string> #include<map> #include<set>…
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3757 题意:根据所给的台球规则,按照每次的结果计算最终两人的得分 单纯的模拟题,分支比较多写起来较繁琐 注意区分犯规与进球得分的规则: 只要有犯规行为,都要按照规则给对手加分.无论是否进球. 当进球时,如果有犯规行为,不仅分要加给对手,还要加上犯规惩罚 #include<cmath> #include<cstdio> #include<cst…
如果L全在地面上: 输出 h * D / H 如果L全在墙上: 输出 h 否则: (D - X ) / X = Y / (H - h) L = D - X + h - Y 然后对L求导即可 #include <stdio.h> #include <string.h> #include <math.h> #include <algorithm> using namespace std; int main(){ double H,h,D,x,y,x0; int…