其他
peace in mind
这个作者很懒,什么都没留下…
展开
-
Sicily 1071. Floors
#include #include #include #include using namespace std; struct rectangle { int x1, y1, x2, y2; rectangle() {} rectangle(int xx1, int yy1, int xx2, int yy2) : x1(xx1), y1(yy1转载 2014-11-21 22:44:12 · 742 阅读 · 0 评论 -
Sicily 1041. Pushing Boxes
转自这位大神 #include #include #include using namespace std; int h, w, p; int boxes[21][21]; int cases = 0; void down() { int moves; cin >> moves; int count = 0; int max = 0; for (int j = 0;原创 2014-12-01 22:41:20 · 762 阅读 · 0 评论 -
Sicily 1231. The Embarrassed Cryptography【高精度取余】
题目链接在此 启示 1 用筛选法构造质数表; 启示 2 memset函数是以字节为单位操作数组的,对于char型数组,第二个参数怎样设置都行,因为每个char刚好就1个字节。但对于int型数组,就不能随便设第二个参数,因为每个int有4个字节。比如想把int a[20]数组的所有值都初始化为1,就不能写memset(a, 1, 20),这样一来每个数组的前5(20/4=5)个元素的原创 2014-12-04 19:39:16 · 963 阅读 · 0 评论 -
Sicily 1193. Up the Stairs
这位大神原创 2014-11-22 14:04:11 · 586 阅读 · 0 评论 -
[Leetcode]Find Peak Element
A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ num[i+1], find a peak element and return its index. The array may contain multiple peaks, i原创 2015-03-30 23:16:52 · 306 阅读 · 0 评论 -
[Leetcode]Number of 1 Bits
那个...暑期实习(打杂),空闲的时候就把leetcode翻出来刷几道。距离上次写博客已经4个月了! 每次自己写完代码,在和网上的大神一对比,简直自愧不如。同时又可以发现很多高能的解法,精神又为之一振! 题目链接在此: Write a function that takes an unsigned integer and returns the number of ’1' bit转载 2015-07-29 17:03:12 · 456 阅读 · 0 评论 -
[Leetcode] Isomorphic Strings
题目链接在此 Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be replaced原创 2015-07-30 15:29:34 · 281 阅读 · 0 评论 -
[LeetCode] Move Zeroes
题目链接在此 转自这位大神 题目描述: Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For example, given nums = [0, 1,转载 2015-10-08 14:14:13 · 330 阅读 · 0 评论 -
Sicily 1214. 信号分析
(1)数列找规律。就是把序号写成二进制(无前导0),再倒过来就能得到对应的值。 1(1) = 1; 2(10) = 1; 3(11) = 3; 4(100) = 1 5(101)=5; 6(110)= 3; 7(111)= 7; 8(1000)= 1; (2)题目要你求的就是在某数之前,其二进制恰好为回文串的数的总数。例如5的二进制是101,是回文串,所以a5=5符合条件原创 2014-12-05 11:50:51 · 666 阅读 · 0 评论