P1603 斯诺登的密码 题目描述 2013年X月X日,俄罗斯办理了斯诺登的护照,于是他混迹于一架开往委内瑞拉的飞机.但是,这件事情太不周密了,因为FBI的间谍早已获悉他的具体位置--但这不是最重要的--最重要的是如果要去委内瑞拉,那么就要经过古巴,而经过古巴的路在美国的掌控之中. 丧心病狂的奥巴马迫降斯诺登的飞机,搜查时却发现,斯诺登杳无踪迹.但是,在据说是斯诺登的座位上,发现了一张纸条.纸条由纯英文构成:Obama is a two five zero.(以"."结束输出,只有6个…
P1056 排座椅 题目描述 上课的时候总会有一些同学和前后左右的人交头接耳,这是令小学班主任十分头疼的一件事情.不过,班主任小雪发现了一些有趣的现象,当同学们的座次确定下来之后,只有有限的 D 对同学上课时会交头接耳.同学们在教室中坐成了 M 行 N 列,坐在第 i 行第 j 列的同学的位置是 (i,j),为了方便同学们进出,在教室中设置了 K 条横向的通道,L 条纵向的通道. 于是,聪明的小雪想到了一个办法,或许可以减少上课时学生交头接耳的问题:她打算重新摆放桌椅,改变同学们桌椅间通道的位置…
B - Sum Problem In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + ... + n. Input The input will consist of a series of integers n, one integer per line. Output For each case, output SUM(n) in one line, followed by a blank line. You may…
P1464 Function 题目描述 对于一个递归函数w(a,b,c)如果a≤0 or b≤0 or c≤0就返回值1.如果a>20 or b>20 or c>20就返回w(20,20,20). 如果a<b并且b<c 就返回w(a,b,c−1)+w(a,b−1,c−1)−w(a,b−1,c).其它的情况就返回w(a−1,b,c)+w(a−1,b−1,c)+w(a−1,b,c−1)−w(a−1,b−1,c−1)这是个简单的递归函数,但实现起来可能会有些问题.当a,b,c均为1…
Problem 2059 MM Accept: 109 Submit: 484Time Limit: 1000 mSec Memory Limit : 32768 KB Problem Description There is a array contain N(1<N<=100000) numbers. Now give you M(1<M<10000) query. Every query will be: 1 x : ask longest substring…
排序 快速排序 用于求解 Kth Element 问题,也就是第 K 个元素的问题. 可以使用快速排序的 partition() 进行实现.需要先打乱数组,否则最坏情况下时间复杂度为 O(N2). 堆排序 用于求解 TopK Elements 问题,也就是 K 个最小元素的问题.可以维护一个大小为 K 的最小堆,最小堆中的元素就是最小元素.最小堆需要使用大顶堆来实现,大顶堆表示堆顶元素是堆中最大元素.这是因为我们要得到 k 个最小的元素,因此当遍历到一个新的元素时,需要知道这个新元素是否比堆中最…
The Robot Moving Institute is using a robot in their local store to transport different items. Of course the robot should spend only the minimum time necessary when travelling from one place in the store to another. The robot can move only along a st…
A tournament is a directed graph without self-loops in which every pair of vertexes is connected by exactly one directed edge. That is, for any two vertexes u and v (u ≠ v) exists either an edge going from u to v, or an edge from v to u. You are give…
There is a rectangular grid of size n×mn×m . Each cell has a number written on it; the number on the cell (i,ji,j ) is ai,jai,j . Your task is to calculate the number of paths from the upper-left cell (1,11,1 ) to the bottom-right cell (n,mn,m ) meet…
Little Tom loves playing games. One day he downloads a little computer game called 'Bloxorz' which makes him excited. It's a game about rolling a box to a specific position on a special plane. Precisely, the plane, which is composed of several unit c…
Background The knight is getting bored of seeing the same black and white squares again and again and has decided to make a journey around the world. Whenever a knight moves, it is two squares in one direction and one square perpendicular to this. Th…
T. Chur teaches various groups of students at university U. Every U-student has a unique Student Identification Number (SIN). A SIN s is an integer in the range 0 ≤ s ≤ MaxSIN with MaxSIN = 10 6-1. T. Chur finds this range of SINs too large for ident…
并不是很正规的.每个人自愿参与自愿退出,马哥找题(马哥超nice么么哒). 放假第一周与放假结束前一周 2015-01-26 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=68304#overview password: scau0126 ID Origin Title 13 / 29 Problem A CodeChef SUBGCD Subarray GCD 8 / 50 Problem B CodeChef SU…
19年东北四省省赛 做了J G C 补了E H J签到题 G 题意: 给n个正方形的两个斜对角点坐标,问最小的移动可以重叠(移动上下左右一格) 思路: 一开始想的是中心pos移动,但是可能有小数,而且半径长度不知,可能有包含关系. 然后发现题目没说一定要某一个正方形移动的最小步数,那之间转换为点在面里面的移动最小,取中间的两个上下斜对角坐标就行了 #include<iostream> #include<cstring> #include<algorithm> #incl…