Pat1085代码
题目描述:
Given a sequence of positive integers and another positive integer p. The sequence is said to be a "perfect sequence" if M
Now given a sequence and a parameter p, you are s...
分类:
其他好文 时间:
2015-01-09 23:48:11
阅读次数:
495
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:
Integers in each row are sorted from left to right.The first integer of each...
分类:
其他好文 时间:
2015-01-09 22:27:36
阅读次数:
272
1:首先谈谈递归
递归算法:递归过程一般通过函数或子过程来实现。递归方法:在函数或子过程的内部,直接或者间接地调用自己的算法。
如何设计递归算法
1.确定递归公式
2.确定边界(终了)条件
递归的一般模式
procedure aaa(k:integer);
begin
if k=1 then (边界条件及必要操作)
...
分类:
编程语言 时间:
2015-01-09 22:24:47
阅读次数:
309
Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 ->...
分类:
其他好文 时间:
2015-01-09 20:46:49
阅读次数:
196
#include void main(){ int i,j,k,N,count; int data[20][20]={0}; printf("Input an integer N:"); scanf("%d",&N); //count=0; count=N*N; for(k=0;kk;i--) .....
分类:
其他好文 时间:
2015-01-09 20:44:07
阅读次数:
123
https://oj.leetcode.com/problems/majority-element/publicclassSolution{
publicintmajorityElement(int[]num){
intlen=num.length;
intminhit=(len/2)+1;
Map<Integer,Integer>map=newHashMap<>();
for(inti:num)
{
Integeroccur=map.get(i);
if(occur==null)
..
分类:
其他好文 时间:
2015-01-09 19:29:48
阅读次数:
167
https://oj.leetcode.com/problems/maximum-product-subarray/http://blog.csdn.net/linhuanmars/article/details/39537283publicclassSolution{
publicintmaxProduct(int[]A)
{
if(A==null||A.length==0)
return0;
intlocalmin=1;
intlocalmax=1;
intglobal=Integer.MIN_VALU..
分类:
其他好文 时间:
2015-01-09 17:39:33
阅读次数:
127
通过检索匹配jQuery对象得到对应的DOM元素。.get( [index ] )index类型:Integer从0开始计数,用来确定获取哪个元素。.get()方法允许我们直接访问jQuery对象中相关的DOM节点。 如果index的值超出范围 - 小于元素数量的负数或等于或大于元素的数量 - 那么...
分类:
Web程序 时间:
2015-01-09 17:07:37
阅读次数:
471
水题
Time Limit: 500ms
Memory Limit: 32768KB
This problem will be judged on HRBUST.
Original ID: 2223
64-bit integer IO format: %lld
Java class name: Main
Prev
Submit Status ...
分类:
其他好文 时间:
2015-01-09 14:18:46
阅读次数:
180
Implement atoi to convert a string to an integer.
Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input case...
分类:
其他好文 时间:
2015-01-09 00:16:53
阅读次数:
233