随笔分类 - 九度oj
摘要:题目描述: We are all familiar with pre-order, in-order and post-order traversals of binary trees. A common problem in data structure classes is to find th
阅读全文
摘要:题目描述: You are given an unsorted array of integer numbers. Your task is to sort this array and kill possible duplicated elements occurring in it. 输入: F
阅读全文
摘要:You are given a sequence of integer numbers. Zero-complexity transposition of the sequence is the reverse of this sequence. Your task is to write a pr
阅读全文
摘要:Output the k-th prime number. k≤10000 The k-th prime number.
阅读全文
摘要:John von Neumann, b. Dec. 28, 1903, d. Feb. 8, 1957, was a Hungarian-American mathematician who made important contributions to the foundations of mat
阅读全文
摘要:Among grandfather's papers a bill was found. 72 turkeys $_679_ The first and the last digits of the number that obviously represented the total price
阅读全文
摘要:读入两个小于100的正整数A和B,计算A+B. 需要注意的是:A和B的每一位数字由对应的英文单词给出. 测试输入包含若干测试用例,每个测试用例占一行,格式为"A + B =",相邻两字符串有一个空格间隔.当A和B同时为0时输入结束,相应的结果不要输出. 对每个测试用例输出1行,即A+B的值.
阅读全文
摘要:某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? 测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城
阅读全文
摘要:给你n个点,m条无向边,每条边都有长度d和花费p,给你起点s终点t,要求输出起点到终点的最短距离及其花费,如果最短距离有多条路线,则输出花费最少的。 输入n,m,点的编号是1~n,然后是m行,每行4个数 a,b,d,p,表示a和b之间有一条边,且其长度为d,花费为p。最后一行是两个数 s,t;起点s
阅读全文
摘要:对于一个字符串,将其后缀子串进行排序,例如grain 其子串有: grain rain ain in n 然后对各子串按字典顺序排序,即: ain,grain,in,n,rain 每个案例为一行字符串。 将子串排序输出 Solution1:(qsort) Solution2:(set)
阅读全文
摘要:在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗? 输入包括多组数据。每组数据第一行是两个整数N、M(N<=100,M<=10000),N表示
阅读全文
摘要:设计一个二次方程计算器 每个案例是关于x的一个二次方程表达式,为了简单,每个系数都是整数形式。 每个案例输出两个实数(由小到大输出,中间由空格隔开),保留两位小数;如果无解,则输出“No Solution”。
阅读全文
摘要:题目描述: 给定n,a求最大的k,使n!可以被a^k整除但不能被a^(k+1)整除。 两个整数n(2<=n<=1000),a(2<=a<=1000) 一个整数.
阅读全文
摘要:题目描述: 对于一个不存在括号的表达式进行计算 存在多种数据,每组数据一行,表达式不存在空格 输出结果
阅读全文
摘要:一个N*M的矩阵,找出这个矩阵中所有元素的和不小于K的面积最小的子矩阵(矩阵中元素个数为矩阵面积) 每个案例第一行三个正整数N,M<=100,表示矩阵大小,和一个整数K 接下来N行,每行M个数,表示矩阵每个元素的值 输出最小面积的值。如果出现任意矩阵的和都小于K,直接输出-1。
阅读全文
摘要:Every positive number can be presented by the exponential form.For example, 137 = 2^7 + 2^3 + 2^0。 Let's present a^b by the form a(b).Then 137 is pres
阅读全文
摘要:题目描述: Finding all occurrences of a pattern in a text is a problem that arises frequently in text-editing programs. Typically,the text is a document be
阅读全文
摘要:A 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 "
阅读全文
摘要:题目描述: 有两个日期,求两个日期之间的天数,如果两个日期是连续的我们规定他们之间的天数为两天 输入: 有多组数据,每组数据有两行,分别表示两个日期,形式为YYYYMMDD 输出: 每组数据输出一行,即日期差值 样例输入: 20110412 20110422 样例输出: 11
阅读全文
摘要:The Fibonacci Numbers{0,1,1,2,3,5,8,13,21,34,55...} are defined by the recurrence: F0=0 F1=1 Fn=Fn-1+Fn-2,n>=2 Write a program to calculate the Fibona
阅读全文

浙公网安备 33010602011771号