OJ
文章平均质量分 79
Blankj
调试的错误就是编程给你最好的东西,因为在每个错误上面都标志着前进的一步。
展开
-
2015浙江省蓝桥杯c/c++B组个人题解
奖券数目有些人很迷信数字,比如带“4”的数字,认为和“死”谐音,就觉得不吉利。虽然这些说法纯属无稽之谈,但有时还要迎合大众的需求。某抽奖活动的奖券号码是5位数(10000-99999),要求其中不要出现带“4”的号码,主办单位请你计算一下,如果任何两张奖券不重号,最多可发出奖券多少张。52488#include #include #include #inc原创 2015-04-12 13:20:40 · 1822 阅读 · 4 评论 -
求最长公共子串(串)
题目描述求采用顺序结构存储的串s和串t的一个最长公共子串,若没有则输出false,若最长的有多个则输出最先出现的那一串。输入要求输入两个字符串输出要求输出公共子串假如输入abcdefadbcef应当输出bc思路:1。 将连个字符串分别以行列组成一个矩阵。2。若该矩阵的节点对应的字符相同,则原创 2014-11-21 17:07:53 · 3895 阅读 · 0 评论 -
Alaska
题目描述Problem B: AlaskaThe Alaska Highway runs 1422 miles from Dawson Creek, British Columbia to Delta Junction, Alaska. Brenda would like to be the first person to drive her new elect原创 2014-11-17 22:23:29 · 1258 阅读 · 0 评论 -
Problem C: Celebrity Split
题目描述Problem C: Celebrity SplitJack and Jill have decided to separate and divide their property equally. Each of their N mansions has a value between 1,000,000 and 40,000,000 dollars. J原创 2014-11-17 21:11:00 · 948 阅读 · 0 评论 -
万年历打印
题目描述根据用户输入的年份,打印当年的年历。输入要求输入多个表示年份的整数,以0结束。输出要求打印每个年份的年历(0除外)。假如输入201320120应当输出 2013 Calander 一月星期一原创 2014-11-16 20:04:18 · 1276 阅读 · 0 评论 -
1073: 软件工程
题目描述做为一名IT高薪人员,在工程项目前做好充分的需求分析工作是最最必要的,没有一个好的项目经理在工程项目开发前对需求分析进行草率的处理。 Jesse做为一个高级的,智慧的,理智的,帅气的,可爱的项目经理,在需求分析时总是把问题考虑的非常之周全.他只有一个团队,在安排项目工期时总是在图纸上 画出每个模块完成的最短工期,而部分模块因受到前面模块的约束而需要先完成前面模块的约束后才能原创 2014-11-13 13:29:26 · 818 阅读 · 0 评论 -
约瑟夫问题
题目描述约瑟夫问题:有n只猴子,按顺时针方向围成一圈选大王(编号从1到n),从第1号开始报数,一直数到m,数到m的猴子退出圈外,剩下的猴子再接着从1开始报数。就这样,直到圈内只剩下一只猴子时,这个猴子就是猴王,编程求输入n,m后,输出最后猴王的编号。输入要求每行是用空格分开的两个整数,第一个是 n, 第二个是 m ( 0 0 0输出要求原创 2014-11-16 13:11:44 · 922 阅读 · 0 评论 -
1316: University
题目描述在大学里,很多单词都是一词多义,偶尔在文章里还要用引申义。这困扰Redraiment很长的时间。他开始搜集那些单词的所有意义。他发现了一些规律,例如“a”能用“e”来代替, “c”能用“f”来代替……现在他给出了字母的替换规则,如下所示,A被E替换,B被C替换,依次类推。A B C D E F G H I J K L M N O P Q R S T U V W X Y Z原创 2014-11-15 15:31:13 · 1477 阅读 · 0 评论 -
目标柏林
题目描述1945年初,苏军和英美联军已从东西两面攻入德国国境。 4月初,在苏军和英美联军的夹击下,德军只能龟缩在以柏林为中心的德国东部的狭长地带,成了瓮中之鳖。 但希特勒困兽犹斗,一方面发出摧毁一切设施,实行“焦土”政策的指令; 另一方面下令把德国分为南北两个行政区,各自作战,他自己则固守柏林。 在这一天,苏军结果一份传自柏林的加密电文。经初步破译,显示希特勒要调集100万兵力, 在柏原创 2014-11-15 14:43:09 · 1959 阅读 · 0 评论 -
小游戏
题目描述迷宫 深搜一天早上,你起床的时候想:“我编程序这么牛,为什么不能靠这个赚点小钱呢?”因此你决定编写一个小游戏。游戏在一个分割成w * h个正方格子的矩形板上进行。如图所示,每个正方格子上可以有一张游戏卡片,当然也可以没有。当下面的情况满足时,我们认为两个游戏卡片之间有一条路径相连:路径只包含水平或者竖直的直线段。路径不能穿过别的游戏卡片。但是允许路原创 2014-12-16 10:15:13 · 1528 阅读 · 1 评论 -
KMP算法中的next[]数组
KMP算法最难懂的就是next[]数组的求法。用一个例子来解释,下面是一个子串的next数组的值,可以看到这个子串的对称程度很高,所以next值都比较大。位置i012345678910111213原创 2014-12-05 21:56:21 · 789 阅读 · 0 评论 -
大数的乘法
题目描述大数是指计算的数值非常大或者对运算的精度要求非常高,用已知的数据类型无法精确表示的数值。例如:我们要计算如下两个数的乘积时,用我们已知的数据类型是无法精确表示其结果的:a1 = 11111111111111111111111111111111111b1 = 11111111111111111111111111111111111111求:a1 * b1;输入要原创 2014-12-07 21:06:45 · 1010 阅读 · 0 评论 -
关于memset函数
相信很多人都知道这个函数,也都用过,但可能很多人跟我过去一样,认为它是赋初值函数,而不知它赋初值是八位八位进行的,知道了这句话那你之后的就都懂了。首先它是在头文件string.h中,这说明了什么呢,他操作的是字符类型,而字符类型有几位呢,那就是八位,所以它就是按八位来赋初值的。之所以我们平时可以用int array[100];memset(array,0,sizrof(array));原创 2015-01-04 23:51:36 · 823 阅读 · 0 评论 -
Additive equations
题目描述 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 an addi原创 2015-01-04 01:52:46 · 1320 阅读 · 0 评论 -
Alphacode
题目描述Alice and Bob need to send secret messages to each other and are discussing ways to encode their messages:Alice: "Let's just use a very simple code: We'll assign 'A' the code word 1, 'B' wil原创 2014-12-29 13:50:34 · 882 阅读 · 0 评论 -
Knight's Trip 马在无线大棋盘上跳到指定点最小步数问题
题目描述Problem D: Knight's Trip In chess, each move of a knight consists of moving by two squares horizontally and one square vertically, or by one square horizontally and two squares vertically.原创 2014-12-09 13:23:40 · 2847 阅读 · 1 评论 -
三类最基本排序(插入,冒泡,选择)
插入是稳定的,冒泡稳定性取决于是否有等号,选择是不稳定的#include#include#include #include#include#includeusing namespace std;void fun();int main(){ fun(); return 0;}void fun(){ int temp,i,j, arr1[8]=原创 2014-12-08 19:50:58 · 749 阅读 · 0 评论 -
0/1背包问题(动态规划)
0/1背包问题:现有n种物品,对1i,价值为正整数Vi,背包能承受的最大载重量为正整数W,现要求找出这n种物品的一个子集,使得子集中物品的总重量不超过W且总价值尽量大。(注意:这里对每种物品或者全取或者一点都不取,不允许只取一部分)根据问题描述,可以将其转化为如下的约束条件和目标函数:于是,问题就归结为寻找一个满足约束条件(1),并使目标函数式(2)达到最大的解向量原创 2014-12-23 22:53:52 · 2597 阅读 · 0 评论 -
A sequence of numbers(快速求幂)
题目描述Xinlv wrote some sequences on the paper a long time ago, they might be arithmetic or geometric sequences. The numbers are not very clear now, and only the first three numbers of each seq原创 2015-01-12 23:31:46 · 891 阅读 · 0 评论 -
小鼠迷宫问题
小鼠a与小鼠b身处一个m×n的迷宫中,如图所示。每一个方格表示迷宫中的一个房间。这m×n个房间中有一些房间是封闭的,不允许任何人进入。在迷宫中任何位置均可沿上,下,左,右4个方向进入未封闭的房间。小鼠a位于迷宫的(p,q)方格中,它必须找出一条通向小鼠b所在的(r,s)方格的路。请帮助小鼠a找出所有通向小鼠b的最短道路。请编程对于给定的小鼠的迷宫,计算小鼠a通向小鼠b的所有最短道路原创 2014-12-07 00:32:41 · 1804 阅读 · 0 评论 -
HTML
DescriptionIf you ever tried to read a html document on a Macintosh, you know how hard it is if no Netscape is installed.Now, who can forget to install a HTML browser? This is very easy becaus原创 2014-03-26 11:52:35 · 633 阅读 · 0 评论 -
Quicksu
DescriptionA checksum is an algorithm that scans a packet of data and returns a single number. The idea is that if the packet is changed, the checksum will also change, so checksums are often used原创 2014-03-25 23:36:09 · 542 阅读 · 0 评论 -
Ambiguous permutations
DescriptionSome programming contest problems are really tricky: not only do they require a different output format from what you might have expected, but also the sample output does not show t原创 2014-03-23 19:20:48 · 641 阅读 · 0 评论 -
Image Perimeters
简单题oj原创 2014-03-23 19:10:37 · 944 阅读 · 0 评论 -
No Brainer
DescriptionZombies love to eat brains. Yum. InputThe first line contains a single integer n indicating the number of data sets.The following n lines each represent a data set. Ea原创 2014-03-23 19:14:23 · 558 阅读 · 0 评论 -
Arne Saknussemm
DescriptionFollowing the account of Jules Verne, a scrambled message written by the middle age alchemist Arne Saknussemm, and deciphered by professor Lidenbrock, started the incredible travel to t原创 2014-03-30 15:12:47 · 682 阅读 · 0 评论 -
WERTYU
DescriptionA common typing error is to place the hands on the keyboard one row to the right of the correct position. So "Q" is typed as "W" and "J" is typed as "K" and so on. You are to原创 2014-03-30 09:04:46 · 943 阅读 · 0 评论 -
Automatic Editing
DescriptionText-processing tools like awk and sed allow you to automatically perform a sequence of editing operations based on a script. For this problem we consider the specific case in which we wa原创 2014-03-29 20:35:48 · 790 阅读 · 0 评论 -
Reverse Text
DescriptionIn most languages, text is written from left to right. However, there are other languages where text is read and written from right to left. As a first step towards a program that automat原创 2014-03-29 18:58:14 · 566 阅读 · 0 评论 -
Round and Round We Go
DescriptionProblemA cyclic number is an integer n digits in length which, when multiplied by any integer from 1 to n, yields a ��cycle�� of the digits of the original number. That is, if原创 2014-03-30 16:23:56 · 1583 阅读 · 0 评论 -
HangOver
DescriptionHow far can you make a stack of cards overhang a table? If you have one card, you can create a maximum overhang of half a card length. (We're assuming that the cards must be perpe原创 2014-03-23 19:01:28 · 547 阅读 · 0 评论 -
Gridland
DescriptionBackgroundFor years, computer scientists have been trying to find efficient solutions to different computing problems. For some of them efficient algorithms are already available,原创 2014-03-23 18:53:16 · 745 阅读 · 0 评论 -
ICPC Score Totalizer Software
DescriptionThe International Clown and Pierrot Competition (ICPC), is one of the most distinguished and also the most popular events on earth in the show business.One of the unique features of原创 2014-03-24 18:13:05 · 561 阅读 · 0 评论 -
Conic Section
The conic sections are the nondegenerate curves generated by the intersections of a plane with one or two nappes of a cone. For a plane perpendicular to the axis of the cone, a circle is produced. For原创 2014-03-25 23:39:18 · 665 阅读 · 0 评论 -
Binary Number
DescriptionFor 2 non-negative integers x and y, f(x, y) is defined as the number of different bits in the binary format ofx and y. For example, f(2, 3)=1, f(0, 3)=2, f(5, 10)=4. Now give原创 2014-03-25 11:28:03 · 1995 阅读 · 0 评论 -
Who is the Smartest Man
DescriptionCao Cao is very pround of his newly finished book named "The Book of Mengde". He thinks the book contains all the wisdom of the world. But in order to prove this, he need to prove原创 2014-03-25 23:45:17 · 796 阅读 · 0 评论 -
Ordinal Numbers
DescriptionOrdinal numbers refer to a position in a series. Common ordinals include zeroth, first, second, third, fourth and so on. Ordinals are not often written in words, they are written using di原创 2014-03-25 11:47:50 · 908 阅读 · 0 评论 -
Wu XING
DescriptionIntroductionThe Wu Xing, or the Five Movements, Five Phases or Five Steps/Stages, are chiefly an ancient mnemonic device, in many traditional Chinese fields.The doctrine of five p原创 2014-03-24 21:34:49 · 1551 阅读 · 0 评论 -
Somali Pirates
DescriptionIt is said that the famous Somali Pirates hate digits. So their QQ passwords never contain any digit. Given some lines of candidate passwords, you are asked to delete all the digi原创 2014-03-24 20:54:51 · 693 阅读 · 0 评论 -
Equal Total Scores
DescriptionTaro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the total scores of their cards equal by exchanging one card原创 2014-03-24 16:32:02 · 1061 阅读 · 0 评论