
ACM
文章平均质量分 82
MingjaLee
这个作者很懒,什么都没留下…
展开
-
LeetCode - Palindrome Partitioning
题目链接:https://leetcode.com/problems/palindrome-partitioning/Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For原创 2016-04-26 16:21:39 · 446 阅读 · 0 评论 -
经典排序方法实现
冒泡排序选择排序插入排序快速排序堆排序希尔排序归并排序#include <iostream>#include <string>#include <algorithm>#include <vector>#include <map>#include <unordered_map>#include <string>using namespace std;vector<int> a原创 2016-09-21 00:50:44 · 632 阅读 · 0 评论 -
素数 筛选获取
https://leetcode.com/problems/count-primes/class Solution {public: int countPrimes(int n) { if(n < 2) return 0; vector<bool> flag(n, true); //flag primes flag[0原创 2016-09-16 21:20:43 · 527 阅读 · 0 评论 -
LeetCode - Binary Tree Level Order Traversal
这题算是树遍历的基础,写这篇博客主要是为了记录两种代码风格的层序遍历。Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree [3,9,20,null,null原创 2016-07-08 22:08:16 · 377 阅读 · 0 评论 -
LeetCode - Permutations II
题目链接:https://leetcode.com/problems/permutations-ii/Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2] have the following unique pe原创 2016-04-27 12:42:19 · 511 阅读 · 0 评论 -
LeetCode - Linked List Cycle I &II
转载:http://www.cnblogs.com/hiddenfox/p/3408931.html题目要求Linked List CycleGiven a linked list, determine if it has a cycle in it.Follow up: Can you solve it without using extra space?如何判断一个单链表中有环?转载 2016-05-09 00:24:32 · 525 阅读 · 0 评论 -
Leetcode 59. Spiral Matrix II
题目描述 Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example, Given n = 3, You should return the following matrix: [ [ 1, 2, 3 ]原创 2016-04-23 09:07:30 · 624 阅读 · 0 评论 -
浮点数转化为字符串
(1)在不调用库函数的情况下,把浮点数转化为字符串的难点就在,把小数转化为字符串。因为浮点数的精度问题,当我们对浮点数进行乘10操作的时候,浮点数尾数数值可能就会发生变化,如float a=12.1047; a*=10;输出a=121.046997。所以在把浮点数的小数转化为字符串时要对精度进行限制。 1 #include 2 #include 3 #include 4原创 2016-04-26 16:31:46 · 26143 阅读 · 0 评论 -
HDU ACM 题目分类
模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 1049 1050 1057 1062 1063 1064 1070 1073 1075 1082 1083 1084 1088 1106 1107 1113 1117 1119 1128 1129 114原创 2016-04-26 16:32:16 · 932 阅读 · 0 评论 -
分数(有理数)的四则运算PAT1088
2015-02-05PAT- B1088. Rational Arithmetic (20)http://www.patest.cn/contests/pat-a-practise/1088 1 #include 2 #include 3 using namespace std; 4 typedef long long LL; 5 typedef st原创 2016-04-26 16:32:18 · 531 阅读 · 0 评论 -
PAT 1059. Prime Factors (25) 质因子分解
题目链接 http://www.patest.cn/contests/pat-a-practise/1059Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p1^k1 * p2^k2 *…*pm^km.Input原创 2016-04-26 16:33:36 · 391 阅读 · 0 评论 -
PAT 大数运算
PAT中关于大数的有B1017,A1023,A1024 (A-Advance,B-Basic)B10171017. A除以B (20)本题要求计算A/B,其中A是不超过1000位的正整数,B是1位正整数。你需要输出商数Q和余数R,使得A = B * Q + R成立。输入格式:输入在1行中依次给出A和B,中间以1空格分隔。输出格式:在1行中依次输出Q和R,中间以1空格原创 2016-04-26 16:33:38 · 601 阅读 · 0 评论 -
最长回文串
https://www.patest.cn/contests/pat-a-practise/1040#include <iostream>#include <string>#include <algorithm>#include <vector>#include <map>#include <unordered_map>#include <string>#include <queue原创 2016-10-16 16:32:05 · 491 阅读 · 0 评论