- 博客(60)
- 资源 (2)
- 收藏
- 关注
翻译 汉诺塔IV
题目描述还记得汉诺塔III吗?他的规则是这样的:不允许直接从最左(右)边移到最右(左)边(每次移动一定是移到中间杆或从中间移出),也不允许大盘放到小盘的上面。xhd在想如果我们允许最大的盘子放到最上面会怎么样呢?(只允许最大的放在最上面)当然最后需要的结果是盘子从小到大排在最右边。输入输入数据的第一行是一个数据T,表示有T组数据。每组数据有一个正整数n(1
2015-11-30 20:31:32 1035
翻译 汉诺塔III
题目描述约19世纪末,在欧州的商店中出售一种智力玩具,在一块铜板上有三根杆,最左边的杆上自上而下、由小到大顺序串着由64个圆盘构成的塔。目的是将最左边杆上的盘全部移到右边的杆上,条件是一次只能移动一个盘,且不允许大盘放在小盘的上面。现在我们改变游戏的玩法,不允许直接从最左(右)边移到最右(左)边(每次移动一定是移到中间杆或从中间移出),也不允许大盘放到下盘的上面。Daisy已经做过原来
2015-11-30 19:39:16 373
翻译 汉诺塔II
Problem Description经典的汉诺塔问题经常作为一个递归的经典例题存在。可能有人并不知道汉诺塔问题的典故。汉诺塔来源于印度传说的一个故事,上帝创造世界时作了三根金刚石柱子,在一根柱子上从下往上按大小顺序摞着64片黄金圆盘。上帝命令婆罗门把圆盘从下面开始按大小顺序重新摆放在另一根柱子上。并且规定,在小圆盘上不能放大圆盘,在三根柱子之间一回只能移动一个圆盘。有预言说,这件事完成时宇宙
2015-11-30 18:45:30 572
翻译 玉蟾宫
题目描述 Description 有一天,小猫rainbow和freda来到了湘西张家界的天门山玉蟾宫,玉蟾宫宫主蓝兔盛情地款待了它们,并赐予它们一片土地。 这片土地被分成N*M个格子,每个格子里写着'R'或者'F',R代表这块土地被赐予了rainbow,F代表这块土地被赐予了freda。 现在freda要在这里卖萌。。。它要找一块矩形土地,要求这片土地都标着'F'并且
2015-11-29 16:20:46 1177
翻译 Substring
描述 You are given a string input. You are to find the longest substring of input such that the reversal of the substring is also a substring of input. In case of a tie, return the string that occurs
2015-11-29 11:02:03 220
翻译 BC 64 Sum
问题描述给n个数A1,A2....An{A}_{1},{A}_{2}....{A}_{n}A1,A2....An,你可以选择一个区间(也可以不选),区间里每个数x变成f(x),其中f(x)=(1890x+143)mod10007f(x)=(1890x+143) mod 10007f(x)=(1890x+143)mod10007。问最后n个数之和最大可能为多少。输入描述
2015-11-29 08:06:35 252
翻译 BC64 Array
问题描述Vicky是个热爱数学的魔法师,拥有复制创造的能力。一开始他拥有一个数列{1}。每过一天,他将他当天的数列复制一遍,放在数列尾,并在两个数列间用0隔开。Vicky想做些改变,于是他将当天新产生的所有数字(包括0)全加1。Vicky现在想考考你,经过100天后,这个数列的前M项和是多少?。输入描述输入有多组数据。第一行包含一个整数T,表示数据组数。T. (1≤T≤2∗10
2015-11-29 07:45:47 283
翻译 修路方案
描述 南将军率领着许多部队,它们分别驻扎在N个不同的城市里,这些城市分别编号1~N,由于交通不太便利,南将军准备修路。现在已经知道哪些城市之间可以修路,如果修路,花费是多少。现在,军师小工已经找到了一种修路的方案,能够使各个城市都联通起来,而且花费最少。但是,南将军说,这个修路方案所拼成的图案很不吉利,想让小工计算一下是否存在另外一种方案花费和刚才的方案一样,现在你来帮小工写一个程
2015-11-28 18:35:24 921
翻译 最大公约数之和
描述 题目很简单,求出:输入每行一个数n(n输出每个结果占一行。样例输入12样例输出40这道题采用了欧拉函数的性质,1-12与12的最大公约数和就为φ(1)*12+φ(2)*6+φ(3)*4+φ(4)*3+φ(6)*2+φ(12)*1直接算出来就行了。#include #include #define LL long longL
2015-11-28 16:15:22 768
翻译 子串和再续(最大m段子串和)
描述 给你一个序列 S1, S2, S3, S4 ... Sx, ... Sn (1 ≤ x ≤ n ≤ 1,000,000, -32768 ≤ Sx ≤ 32767). 我们定义sum(i, j) = Si + ... + Sj (1 ≤ i ≤ j ≤ n).现在给你一个 m(8>m>0&&msum(i1, j1) + sum(i2, j2) + sum(i3, j3) + ... +
2015-11-27 18:23:17 465
翻译 Color the fence
描述 Tom has fallen in love with Mary. Now Tom wants to show his love and write a number on the fence opposite to Mary’s house. Tom thinks that the larger the numbers is, the more chance to win Ma
2015-11-27 11:51:24 281
翻译 Othello
UVa 220这道题体现的就是操作和题目的理解能力,操作其实不难,主要是要理解题目,输出的时候注意个数就可以了,在输出白色和黑色有多少个时,每个数字占两位(%2d),能走的坐标只有中间有一个空格,换行是每组数据之间一个换行,当一方在某个坐标上下棋时,如果不能使对方换颜色,那么就变为对方走,每次下子后,下棋人变化,其他的就是一个个操作就行了。#in
2015-11-27 07:44:26 438
翻译 签到题
描述 hrw最近看到一个有趣的几何题,题目描述是这样的:一个大圆盘里面放入许多小圆盘,每个小圆盘必须接触大圆盘边缘且与其他小圆盘不能相交,但它们可以互相接触,每个小圆盘具有相同的半径,求此条件下能否放入n个小圆盘。输入Multiple sets of test data,The first line contains three integers n, R and r (1 ≤ n ≤
2015-11-26 19:43:47 617
翻译 最大的数
描述 小明和小红在打赌说自己数学学的好,于是小花就给他们出题了,考考他们谁NB,题目是这样的给你N个数在这n个数之间添加N-1个*或+,使结果最大,但不可以打乱原顺序,请得出这个结果如1 3 5结果是(1+3)*5=20;最大可以添加若干个括号,但一定要保证配对,但是每两个数之间只可能有一个*或+数列最前和最后不应有+或乘小明想赢小红但是他比较笨,请你帮帮他输入
2015-11-26 10:39:07 274
翻译 Squares
Uva201开始想图保存,后面打印节点就发现错了,所以只能保存每个点的方向,方向只需要两个就行了,然后对每个有向右的点枚举一次,统计个数就行了,每个点只与下面的点匹配就行了。#include #include const int maxn = 15;int cnt[maxn];int dx[2] = { 0, 1 }, dy[2] = { 1, 0
2015-11-25 21:37:50 571
翻译 Dividing
Problem DescriptionMarsha and Bill own a collection of marbles. They want to split the collection among themselves so that both receive an equal share of the marbles. This would be easy if all the m
2015-11-25 13:25:32 580
翻译 开心的mdd
描述 himdd有一天闲着无聊,随手拿了一本书,随手翻到一页,上面描述了一个神奇的问题,貌似是一个和矩阵有关的东西。给出三个矩阵和其行列A1(10*100),A2(100*5),A3(5*50)。现在himdd要算出计算矩阵所要的乘法次数,他发现不同的计算次序,所要的乘法次数也不一样,如:(A1*A2)*A3 : 10*100*5+5*10*50=7500;A1*(A2*A3)
2015-11-23 16:56:38 315
翻译 Auction
DescriptionTHE 30th ACM/ICPC ASIA REGIONAL 2005 HANGZHOU SITEOnsite Contest SessionProblem A: Auction Recently the auction house has introduced a new type of auction, the lowest
2015-11-22 20:09:29 527
翻译 BC63 sequence2
问题描述给定长度为nnn的序列bib_ibi,求有多少长度为kkk的本质不同的上升子序列。设该序列位置为a1,a2...aka_1, a_2 ... a_k一个序列为上升子序列,当且仅当a1且ba1。本质不同当且仅当两个序列aa和AA存在一个iii使得ai≠Ai。输入描述若干组数据(大概555组)。每组数据第一行两个整数n(1≤n≤100),k(1≤k≤n)n
2015-11-22 18:41:34 311
翻译 BC63 matrix
问题描述给定n∗mn*mn∗m(n+mn+mn+m为奇数)的矩阵,从(1,1)(1,1)(1,1)走到(n,m)(n,m)(n,m)且只能往右往下走,设经过的数为a1,a2...a2ka_1, a_2 ... a_{2k}a1,a2...a2k,贡献为a1∗a2+a3∗a4+...+a2k−1∗a2ka_1*a_2+a_3*a_4+...+a_{2k-1}*a_{2k}a1
2015-11-21 21:48:22 363
翻译 整数因子分解问题
题目描述大于1 的正整数n可以分解为:n=x1*x2*…*xm。例如,当n=12 时,共有8 种不同的分解式:12=12;12=6*2;12=4*3;12=3*4;12=3*2*2;12=2*6;12=2*3*2;12=2*2*3。对于给定的正整数n,编程计算n共有多少种不同的分解式。输入每组测试数据的第一行有1 个正整数n(
2015-11-20 07:59:21 3977 3
翻译 Same binary weight
描述 The binary weight of a positive integer is the number of 1's in its binary representation.for example,the decmial number 1 has a binary weight of 1,and the decimal number 1717 (which is 11010110
2015-11-19 21:55:04 223
翻译 Skip Letter Code
DescriptionRomeo and Juliet are college students in the city of Verona and are in love with each other. Unfortunately, both their families are not very glad with this fact. They are trying to prev
2015-11-19 21:04:12 541
翻译 填数
0 1 2 3 4 5 6 7 8 9 _ _ _ _ _ _ _ _ _ _在横线上填写数字,使之符合要求。要求如下:对应的数字下填入的数,代表上面的数在下面出现的次数,比如3下面是1,代表3要在下面出现一次。正确答案是:0 1 2 3 4 5 6 7 8 9 6 2 1 0 0 0 1 0 0 0这个问题下面
2015-11-19 18:48:21 1102 3
原创 整数中的1(二)
描述 给出两个非负32位整型范围内的数a,b,请输出闭区间[a,b]内所有数二进制中各个位的1的总个数。输入有多组测试数据每组测试数据只有一行,是两个整型数a,b(0当a,b都是0时表示输入结束,该组输入不用计算。测试数据的组数不超过1000组输出对于每组输入,输出区间[a,b]内所有数二进制中各个位的1的总个数。样例输入1 2100 2000 0样例输出2419
2015-11-19 16:05:18 528
翻译 Exchange Rates
DescriptionUsing money to pay for goods and services usually makes life easier, but sometimes people prefer to trade items directly without any money changing hands. In order to ensure a consistent
2015-11-19 13:55:57 308
翻译 Audiophobia
UVa 10048这道题只需要在Floyd算法稍微改一下就行了,求出间接能到达一点的最大值,和本身求出最小值就行了。#include #define INF 100000005const int maxn = 105;int map[maxn][maxn], n, m;void init ( ){ for ( int i = 0; i <= n; i ++ )
2015-11-18 12:52:14 811
翻译 Fire Station
DescriptionA city is served by a number of fire stations. Some residents have complained that the distance from their houses to the nearest station is too far, so a new station is to be built. You a
2015-11-17 21:10:56 353
翻译 Free Candies
DescriptionLittle Bob is playing a game. He wants to win some candies in it - as many as possible.There are 4 piles, each pile contains N candies. Bob is given a basket which can hold at most 5
2015-11-16 21:30:48 553
翻译 DoIt is Being Flooded
DescriptionGlobal warming affects the whole world right now. DoIt is a country which is surrounded by the sea and suffering from global warming. Scientists in DoIt find out that the sea level will
2015-11-16 19:46:41 356 1
翻译 FatMouse and JavaBean II
DescriptionSo this is the second version of FatMouse and his favorite food, JavaBean -- boy he just cannot have enough of it, can he? Again FatMouse was lucky enough to find a map of another storeho
2015-11-16 10:43:11 359
翻译 The Intervals
DescriptionCantor, the famous mathematician, was working on a problem about intervals.Let's start from a line segment of unit length. Remove its middle 1/3. Now remove the middle 1/3's fro
2015-11-16 09:14:48 339
翻译 Communication System
DescriptionWe have received an order from Pizoor Communications Inc. for a special communication system. The system consists of several devices. For each device, we are free to choose from several
2015-11-14 12:12:13 912
翻译 Code
DescriptionKEY Inc., the leading company in security hardware, has developed a new kind of safe. To unlock it, you don't need a key but you are required to enter the correctn-digit code on a key
2015-11-13 16:56:46 348
翻译 Additive equations
Description We all understand that an integer set is a collection of distinct integers. Now the question is: given an integer set, can you find all its addtive equations? To explain what anad
2015-11-13 15:22:13 334
翻译 Flipping Burned Pancakes
DescriptionThe cook at the Frobbozz Magic Pancake House sometimes falls asleep on the job while cooking pancakes. As a result, one side of a stack of pancakes is often burned. Clearly, it is bad b
2015-11-12 08:36:34 537
翻译 Hanoi Tower
DescriptionYou all must know the puzzle named "The Towers of Hanoi". The puzzle has three pegs (peg 1, peg 2 and peg 3) and N disks of different radii. Initially all disks are located on the first
2015-11-11 20:06:03 342
翻译 等差数列
题目描述 Description 一个等差数列是一个能表示成a, a+b, a+2b,..., a+nb (n=0,1,2,3,...)的数列。在这个问题中a是一个非负的整数,b是正整数。写一个程序来找出在双平方数集合(双平方数集合是所有能表示成p的平方 + q的平方的数的集合,其中p和q为非负整数)S中长度为n的等差数列。输入描述 Input Descriptio
2015-11-11 19:31:11 791
翻译 A+B in Hogwarts
DescriptionIf you are a fan of Harry Potter, you would know the school he is attending to, the Hogwarts School for Witchcraft and Wizardry. What you might not know is that Harry is never good at m
2015-11-11 14:09:08 397
翻译 Loongint 的花篮
DescriptionLoongint 要和 MM 结婚了。在两人的走进礼堂的红地毯两侧,需要摆一些装饰用的花篮,有一些不同高度的花篮,现在这些花篮被 Loongint 依照自己的美学观念编号为S1, S2, S3 … Sn(两侧的花篮高度一样)。可 Loongint的 MM 对这些花篮的摆放方式有不同的看法,她觉得满足以下条件的花篮摆放才是最好的。如果对于区间[Si, Sj](1 ≤i<j
2015-11-11 12:58:28 747
MyBatis3_用户指南(附JavaDB实例)
2017-08-31
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人