- 博客(18)
- 收藏
- 关注
原创 Vijos P1123均分纸牌
有 N 堆纸牌,编号分别为 1,2,…, N。每堆上有若干张,但纸牌总数必为 N 的倍数。可以在任一堆上取若于张纸牌,然后移动。移牌规则为:在编号为 1 堆上取的纸牌,只能移到编号为 2 的堆上;在编号为 N 的堆上取的纸牌,只能移到编号为 N-1 的堆上;其他堆上取的纸牌,可以移到相邻左边或右边的堆上。现在要求找出一种移动方法,用最少的移动次数使每堆上纸牌数都一样多。例如 N=4,4 堆纸牌数分别为:① 9 ② 8 ③ 17 ④ 6移动3次可达到目的:从 ③ 取 4 张牌放到 ④ (9 8 1
2016-02-29 22:13:45 652
原创 Vijos P1097合并果子
在一个果园里,多多已经将所有的果子打了下来,而且按果子的不同种类分成了不同的堆。多多决定把所有的果子合成一堆。 每一次合并,多多可以把两堆果子合并到一起,消耗的体力等于两堆果子的重量之和。可以看出,所有的果子经过n-1次合并之后,就只剩下一堆了。多多在合并果子时总共消耗的体力等于每次合并所耗体力之和。 因为还要花大力气把这些果子搬回家,所以多多在合并果子时要尽可能地节省体力。假定每个果子重量都为1,并且已知果子的种类数和每种果子的数目,你的任务是设计出合并的次序方案,使多多耗费的体力最少,并输出这个最小
2016-02-29 21:46:03 389
原创 Vijos P1911珠心算测验
珠心算是一种通过在脑中模拟算盘变化来完成快速运算的一种计算技术。珠心算训练, 既能够开发智力,又能够为日常生活带来很多便利,因而在很多学校得到普及。某学校的珠心算老师采用一种快速考察珠心算加法能力的测验方法。他随机生成一个正整数集合,集合中的数各不相同,然后要求学生回答:其中有多少个数,恰好等于集合中另外两个(不同的)数之和?最近老师出了一些测验题,请你帮忙求出答案。
2016-02-29 21:18:34 710
原创 Vijos P1848记数问题【sprintf用法】
试计算在区间 1 到 n 的所有整数中,数字 x(0 ≤ x ≤ 9)共出现了多少次?例如,在 1 到 11 中,即在 1、2、3、4、5、6、7、8、9、10、11 中,数字 1 出现了 4 次。
2016-02-29 20:56:22 541
原创 NYOJ 303-序号互换【模拟】
Dr.Kong设计了一个聪明的机器人卡多,卡多会对电子表格中的单元格坐标快速计算出来。单元格的行坐标是由数字编号的数字序号,而列坐标使用字母序号。观察字母序号,发现第1列到第26列的字母序号分别为A,B,…,Z,接着,第27列序号为AA,第28列为AB,依此类推。若给Dr.Kong的机器人卡多一个数字序号(比如32),它能很快算出等价的字母序号(即AF),若给机器人一个字母序号(比如AA)),它也能很快算出等价的数字序号(27),你能不能与卡多比试比试,看谁能算得更快更准确。
2016-02-26 16:08:47 482
原创 NYOJ 7-街区最短路径问题【数学】
题目7 题目信息 运行结果 本题排行 讨论区街区最短路径问题时间限制:3000 ms | 内存限制:65535 KB难度:4描述一个街区有很多住户,街区的街道只能为东西、南北两种方向。住户只可以沿着街道行走。各个街道之间的间隔相等。用(x,y)来表示住户坐在的街区。例如(4,20),表示用户在东西方向第4个街道,南北方向第20个街道。现在要建一个邮局,使得各...
2016-02-26 13:23:12 406
原创 POJ 3601-Subsequence【尺取法】
A sequence of N positive integers (10 < N < 100 000), each of them less than or equal 10000, and a positive integer S (S < 100 000 000) are given. Write a program to find the minimal length of the subsequence of consecutive elements of the sequence, the su
2016-02-25 17:25:03 596
原创 Vijos P1199核弹危机
shibowen和ganggang正在玩红警,可不料shibowen造出了核弹正要发射......(ganggang @_@)已知核弹的攻击范围是边长n的正方形,ganggang的基地是边长m的正方形基地样例:...#.#.#...###...#........####.#....#表示房屋,.表示平地,求核弹最多能摧毁多少房屋(被核弹攻击的房屋都会消失,好强啊~~~)。
2016-02-24 22:10:02 788
原创 HDOJ 5630-Rikka with Chess
Yuta gives Rikka a chess board of size n×m.As we all know, on a chess board, every cell is either black or white and every two cells that share a side have different colors.Rikka can choose any rectangle formed by board squares and perform an inversion
2016-02-21 13:33:06 449
原创 CodeForces-630B. Moore's Law
The city administration of IT City decided to fix up a symbol of scientific and technical progress in the city's main square, namely an indicator board that shows the effect of Moore's law in real time.Moore's law is the observation that the number of tra
2016-02-20 16:54:53 585
原创 CodeForces-630C. Lucky Numbers
The numbers of all offices in the new building of the Tax Office of IT City will have lucky numbers.Lucky number is a number that consists of digits 7 and 8 only. Find the maximum number of offices in the new building of the Tax Office given that a door-p
2016-02-20 10:40:39 483
原创 CodeForces-630A. Again Twenty Five!【找规律】
The HR manager was disappointed again. The last applicant failed the interview the same way as 24 previous ones. "Do I give such a hard task?" — the HR manager thought. "Just raise number 5 to the power of n and get last two digits of the number. Yes, of c
2016-02-20 09:03:22 631 2
原创 ZOJ Problem Set - 2965
In a party held by CocaCola company, several students stand in a circle and play a game.One of them is selected as the first, and should say the number 1. Then they continue to count number from 1 one by one (clockwise). The game is interesting in that, o
2016-02-14 14:19:18 314
原创 SCU-2511: Moooo【单调栈】
2511: MooooSubmit your solution Discuss this problem Best solutions Description Farmer John's N (1 <= N <= 50,000) cows are standing in a very straight row and mooing. Each...
2016-02-14 12:20:48 452
原创 SCU-1005: Move cards
1005: Move cardsSubmit your solution Discuss this problem Best solutions The Problem There are N piles of cards, and these piles are numbered as 1,2,...,N respectively. Each pile...
2016-02-14 11:17:23 467
原创 HDOJ 5606-tree【并查集】
There is a tree(the tree is a connected graph which contains n points and n−1 edges),the points are labeled from 1 to n,which edge has a weight from 0 to 1,for every point i∈[1,n],you should find the number of the points which are closest to it,the clostes
2016-02-05 20:06:41 340
原创 BUAA 1386-DZY的根 【贪心】
DZY是个没有根的人,他十分想要有根,这样才能。。。智商爆表的计算机大神WJC决定再帮帮他,他用程序制造了N个根——有生命的根!这N个根和WJC一样都十分机智,他们要参加国际象棋比赛,该比赛要进行K场对弈。每个根最多参加两场对弈,最少参加零场对弈。每个根都有一个与其他根都不相同的等级(用一个正整数来表示)。在对弈中,等级高的根必须用黑色的棋子,等级低的根必须用白色的棋子。 每个根最多只能用一次黑色的棋子和一次白色的棋子。为了增加比赛的客观度,观众希望K场对弈中双方等级差的总和最小。比如有7个根,他们的
2016-02-02 21:43:03 355
原创 HDOJ 5505-GT and numbers
You are given two numbers N and M.Every step you can get a new N in the way that multiply N by a factor of N.Work out how many steps can N be equal to M at least.If N can't be to M forever,print −1.
2016-02-02 10:29:19 384
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人