上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 37 下一页

2014年6月5日

Codeforces 439C

摘要: 题目链接比赛时间没能通过==, 只能说明自己代码写的太不严谨咯!解题思想就是贪心先判断无解的情况: 1. 奇数不够,因为偶数是无法凑成奇数的 2. 偶数不够,2个奇数可以凑成一个偶数 3. 在奇数够用的情况下, 先在k-p堆中每一堆都放一个奇数, 那么剩余的奇数个数一定是个偶数,否则必定会... 阅读全文

posted @ 2014-06-05 10:29 Stomach_ache 阅读(252) 评论(0) 推荐(0) 编辑

2014年6月4日

LeetCode --- Roman to Integer

摘要: 题目链接将罗马数字转换为十进制整数。数据范围为:1~3999罗马数字由7种字母组成,按照特定规则可以组成任意正整数, 需要注意的是罗马数字中没有”0“.关于罗马数字具体可以看:这里附上代码: 1 class Solution { 2 public: 3 int romanToInt(stri... 阅读全文

posted @ 2014-06-04 15:48 Stomach_ache 阅读(107) 评论(0) 推荐(0) 编辑

LeetCode --- Maximum Depth of Binary Tree

摘要: 题目链接求树的最大深度附上代码: 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 ... 阅读全文

posted @ 2014-06-04 15:19 Stomach_ache 阅读(122) 评论(0) 推荐(0) 编辑

LeetCode --- Minimum Path Sum

摘要: 题目链接简单倒推附上代码: 1 class Solution { 2 public: 3 int minPathSum(vector > &grid) { 4 int n = (int)grid.size(); 5 if (n == 0) return 0; ... 阅读全文

posted @ 2014-06-04 14:38 Stomach_ache 阅读(142) 评论(0) 推荐(0) 编辑

2014年6月3日

Hashkell 第一篇

摘要: 心情极差。。。。。。。。。。。。。。。。。。无事可做,其实是没心情去做事情,只好又翻起了haskell入门记下几点,以备查询:1. 函数名首字符是不可以大写的, 而且名称中可以有单引号,这也是合法的2. if语句中else部分是不可以省略的3. 函数声明无先后顺序4. 数字5既可以是整形也可... 阅读全文

posted @ 2014-06-03 08:39 Stomach_ache 阅读(772) 评论(0) 推荐(0) 编辑

2014年6月2日

LeetCode --- Partition List

摘要: 题目链接又是一个考察对链表基本操作的题目附上代码: 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * Lis... 阅读全文

posted @ 2014-06-02 11:08 Stomach_ache 阅读(157) 评论(1) 推荐(0) 编辑

2014年5月29日

LeetCode --- Valid Palindrome

摘要: 题目链接判断字符串是否为回文串。附上代码: 1 class Solution { 2 public: 3 bool isPalindrome(string s) { 4 if (s.empty()) return true; // consider empty string ... 阅读全文

posted @ 2014-05-29 21:54 Stomach_ache 阅读(130) 评论(0) 推荐(0) 编辑

LeetCode --- Longest Consecutive Sequence

摘要: 题目链接对unordered_set和set的内部实现还不了解,只知道前者是hash实现的,后者是用R-B-Tree实现。有时间需要读下源码。附上代码: 1 class Solution { 2 public: 3 int longestConsecutive(vector &num) { ... 阅读全文

posted @ 2014-05-29 12:28 Stomach_ache 阅读(101) 评论(0) 推荐(0) 编辑

LeetCode --- Insertion Sort List

摘要: 题目链接实现链表的插入排序附上代码: 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(i... 阅读全文

posted @ 2014-05-29 01:24 Stomach_ache 阅读(123) 评论(0) 推荐(0) 编辑

2014年5月27日

数据库lib7第2, 3题(创建索引和触发器)

摘要: 2. 分别为上述建立的表格建立适当的索引,请描述建立索引的过程(可以截图或者写SQL)。其中,要求对SPJ标中的SNo, PNo字段各建立一个索引,为(PNo, JNo)的组合建立一个索引。请问,SNo和PNo上的索引是聚集索引还是非聚集索引?为什么?附上代码:1 create index SNo_... 阅读全文

posted @ 2014-05-27 13:40 Stomach_ache 阅读(208) 评论(0) 推荐(0) 编辑

上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 37 下一页

导航