摘要: 54.Spiral Matrix Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example,Given the follow 阅读全文
posted @ 2016-10-20 19:45 hudiwei-hdw 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Problem Description 我们定义如下矩阵:1/1 1/2 1/31/2 1/1 1/21/3 1/2 1/1矩阵对角线上的元素始终是1/1,对角线两边分数的分母逐个递增。请求出这个矩阵的总和。 Input 每行给定整数N (N<50000),表示矩阵为 N*N.当N为0时,输入结束。 阅读全文
posted @ 2016-06-12 17:51 hudiwei-hdw 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 玩过方块消除游戏吗?现在规定当有两个或两个以上相邻且颜色相同的方块在一起的时候,它们就会产生消除反应。当存在多个消除反应同时产生时,最下的反应先执行。现在只给你其中一列,求最后剩下的方块结果。 输入要求 第一行是一个整数T(T<=100),表示有T组测试数据。每组测试数据一行。每行有一串数字(数字长 阅读全文
posted @ 2016-06-08 17:57 hudiwei-hdw 阅读(474) 评论(0) 推荐(0) 编辑
摘要: 计算a^n % b,其中a,b和n都是32位的整数。 快速幂搞就过了.快速幂首先就是要知道 (a*b)%c = ((a%c)*b)%c ,所以经过推导得出. (a^n)%b = ((((a%b)*a)%b)*a)..........%b)*a) %b (n次) 这样只能解决的a^n 超出计算机计数范 阅读全文
posted @ 2016-06-08 11:41 hudiwei-hdw 阅读(305) 评论(0) 推荐(0) 编辑
摘要: 48. Rotate Image Total Accepted: 69437 Total Submissions: 198781 Difficulty: Medium You are given an n x n 2D matrix representing an image. Rotate the 阅读全文
posted @ 2016-05-31 10:39 hudiwei-hdw 阅读(202) 评论(0) 推荐(0) 编辑
摘要: Hot~~招聘——亚信科技,巴卡斯(杭州),壹晨仟阳(杭州),英雄互娱(杭州) (包括2016级新生)除了校赛,还有什么途径可以申请加入ACM校队? Red and Black Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32 阅读全文
posted @ 2016-05-10 17:53 hudiwei-hdw 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 描述 某国为了防御敌国的导弹袭击,研发出一种导弹拦截系统。但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能高于前一发的高度。某天,雷达捕捉到敌国的导弹来袭。由于该系统还在试验阶段,所以只有一套系统,因此有可能不能拦截所有的导弹。 描述 某国为了防御敌国的 阅读全文
posted @ 2016-05-04 14:34 hudiwei-hdw 阅读(250) 评论(0) 推荐(0) 编辑
摘要: 343. Integer Break Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Ret 阅读全文
posted @ 2016-04-28 16:58 hudiwei-hdw 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 今年暑假不AC Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 43909 Accepted Submission(s): 23436 Probl 阅读全文
posted @ 2016-04-27 11:02 hudiwei-hdw 阅读(256) 评论(0) 推荐(0) 编辑
摘要: Let L denote the number of 1s in integer D's binary representation. Given two integers S1 and S2, we call D a XHY number if S1≤L≤S2. With a given D, w 阅读全文
posted @ 2016-04-13 14:09 hudiwei-hdw 阅读(299) 评论(0) 推荐(0) 编辑