- 博客(70)
- 资源 (2)
- 收藏
- 关注
原创 sql---临时表
建立临时表并插入数据select sector_id, phycellid as pci into temp from tbcell where sector_id in ( select distinct tbcell.sector_id from tbcell, tbcell38400 where tbcell.ENODEB
2016-04-26 10:59:04 373
原创 SQL---用一张表中的一列更新另一张表中的一列
test_step2all_38400:tbcell38400:用tbcell38400中的pci替换掉test_step2all_38400中的phycellidupdate test_step2all_38400set test_step2all_38400.phycellid = tbcell38400.pcifrom test_step2all_38400, tbcell38400w
2016-04-26 10:10:30 2902
原创 KMP
输入 第一行一个整数N,表示测试数据组数。接下来的N*2行,每两行表示一个测试数据。在每一个测试数据中,第一行为模式串,由不超过10^4个大写字母组成,第二行为原串,由不超过10^6个大写字母组成。其中N<=20输出 对于每一个测试数据,按照它们在输入中出现的顺序输出一行Ans,表示模式串在原串中出现的次数。#include "iostream"#include "algorithm"#in
2016-04-22 16:27:34 332
原创 最短作业优先---SJF
#include "iostream"#include "algorithm"#include "math.h"#define max(a, b) a > b ? a : b;using namespace std;struct JB{ int r; //提出请求时间 int d; //服务时间 float s; //开始服务时间 float f;
2016-04-22 13:43:08 1605
原创 leetcode---Best Time to Buy and Sell Stock
Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), desi
2016-04-16 12:54:07 277
原创 c#---读文件
weight = new int[N, N]; //加权矩阵 string[] lines = System.IO.File.ReadAllLines(@"F:\1.txt"); int i = 0; char c = ' '; foreach (string line in lines) //按行读取为字符串数组 { string[] arr = line.Split(c)
2016-04-14 20:09:44 327
原创 后续遍历---树、深搜
时间限制:10000ms 单点时限:1000ms 内存限制:256MB给出一棵二叉树的前序和中序遍历的结果,还原这棵二叉树并输出其后序遍历的结果。提示:分而治之——化大为小,化小为无 输入每个测试点(输入文件)有且仅有一组测试数据。每组测试数据的第一行为一个由大写英文字母组成的字符串,表示该二叉树的前序遍历的结果。每组测试数据的第二行为一个由大写英文字母组成的字符串,表示该二叉树的中序遍历的结
2016-04-10 11:58:53 466
原创 leetcode---Factorial Trailing Zeroes
Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.class Solution {public: int trailingZeroes(int n) { if(n ==
2016-04-09 23:21:52 268
原创 leetcode---Majority Element
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element always
2016-04-09 23:05:39 277
原创 leetcode---Excel Sheet Column Title
Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example:1 -> A2 -> B3 -> C...26 -> Z27 -> AA28 -> AB class Solution {public: string convertTo
2016-04-09 22:45:51 278
原创 leetcode---Valid Palindrome
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example, “A man, a plan, a canal: Panama” is a palindrome. “race a car” is not a palin
2016-04-09 21:58:49 308
原创 leetcode---Pascal's Triangle II
Given an index k, return the kth row of the Pascal’s triangle.For example, given k = 3, Return [1,3,3,1].class Solution {public: vector<int> getRow(int rowIndex) { vector<int> v;
2016-04-09 21:50:10 261
原创 leetcode---Pascal's Triangle
Given numRows, generate the first numRows of Pascal’s triangle.For example, given numRows = 5, Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ]class Solution {public: ve
2016-04-09 21:46:27 288
原创 leetcode---Path Sum
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example: Given the below binary tree and sum = 2
2016-04-09 19:48:21 252
原创 leetcode---Minimum Depth of Binary Tree
Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node./** * Definition for a binary tree node.
2016-04-09 18:58:48 246
原创 leetcode---Balanced Binary Tree
Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by
2016-04-09 18:27:00 819
原创 leetcode---Binary Tree Level Order Traversal II
Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right, level by level from leaf to root).For example: Given binary tree {3,9,20,#,#,15,7},
2016-04-09 18:15:37 253
原创 leetcode---Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node./** * Definition for a binary tree node.
2016-04-09 18:09:20 298
原创 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,#,#,15,7}, 3 / \ 9 20 / \
2016-04-09 17:47:26 272
原创 leetcode--- Symmetric Tree---平衡二叉树
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric:1/ \ 2 2 / \ / \ 3 4 4 3 But the following is not:
2016-04-09 16:35:54 257
原创 leetcode---Same Tree
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value./** * Definition f
2016-04-09 16:14:05 209
原创 leetcode---Plus One
Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.class Solution {public:
2016-04-09 16:09:24 491
原创 leetcode---Length of Last Word---字符串
Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘, return the length of last word in the string.If the last word does not exist, return 0.Note: A word is defined as
2016-04-09 15:49:19 228
原创 leetcode---Count and Say
The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, …1 is read off as “one 1” or 11. 11 is read off as “two 1s” or 21. 21 is read off as “one 2, the
2016-04-09 15:39:52 236
原创 leetcode---Add Binary---string
Given two binary strings, return their sum (also a binary string).For example, a = “11” b = “1” Return “100”.class Solution {public: string addBinary(string a, string b) { int len1 = a.
2016-04-08 21:37:34 336
原创 leetcode---Climbing Stairs
You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?class Solution {public: int clim
2016-04-08 12:34:00 201
原创 leetcode---Merge Sorted Array
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note: You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additional
2016-04-08 11:31:51 201
原创 leetcode---Rectangle Area
Find the total area covered by two rectilinear rectangles in a 2D plane.Each rectangle is defined by its bottom left corner and top right corner as shown in the figure.Rectangle Area Assume that the t
2016-04-07 23:49:33 254
原创 leetcode---Count Primes---素数筛法的改进
Description:Count the number of prime numbers less than a non-negative number, n.class Solution {public: int countPrimes(int n) { bool get[n]; memset(get, false, sizeof(get));
2016-04-07 18:11:23 311
原创 leetcode---Number of 1 Bits
Write a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11’ has binary representation 0000000000000
2016-04-07 17:36:37 297
原创 leetcode---Power of Two---lower_bound,upper_bound,binary_search
Given an integer, write a function to determine if it is a power of two.Credits: Special thanks to @jianchao.li.fighter for adding this problem and creating all test cases.Subscribe to see which compa
2016-04-07 17:14:40 448
原创 Islands Travel---Dijkstra
时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 There are N islands on a planet whose coordinates are (X1, Y1), (X2, Y2), (X3, Y3) …, (XN, YN). You starts at the 1st island (X1, Y1) and your destination is
2016-04-06 14:21:59 427
原创 单源最短路径---Dijkstra
#include "iostream"#include "vector"#include "string.h"#include "fstream"#include "queue"#include "stdio.h"using namespace std;const int MAX_V = 100;const int INF = 10000;int V; //顶点数int dist
2016-04-06 11:48:27 330
原创 Professor Q's Software---拓扑排序
时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Professor Q develops a new software. The software consists of N modules which are numbered from 1 to N. The i-th module will be started up by signal Si. If si
2016-04-05 22:36:30 359
原创 leetcode---First Bad Version---二分查找
You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the
2016-04-05 18:38:29 290
原创 leetcode---Ugly Number
Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly since it in
2016-04-05 17:46:04 261
原创 竖式问题
找出所有形如abc*de的算式,使得在完整的竖式中,所有数字都属于一个特定的数字集合。#include "iostream"#include "vector"#include "string.h"#include "set"#include "ctype.h"#include "stdio.h"using namespace std;int main(){ char s[10
2016-04-05 10:38:21 635
原创 最长回文子串
输入一个字符串,求出其中最长的回文串。子串的含义是:在原串中连续出现的字符串片段。在判断时,应该忽略所有标点符号和空格,且忽略大小写,但输出保持原样。输入字符串长度不超过5000,且单独占据一行。应该输出最长的回文串,如果有多个,输出起始位置最靠左的。#include "iostream"#include "vector"#include "string.h"#include "set"#i
2016-04-05 10:00:23 377
原创 Cutting Game---博弈
#include "iostream"#include "vector"#include "string.h"#include "set"using namespace std;int mem[200][200];int grundy(int w, int h){ if(mem[w][h] != -1) return mem[w][h]; int i;
2016-04-04 22:54:48 417
原创 Grundy数---博弈
#include "iostream"#include "vector"#include "string.h"#include "set"using namespace std;int grundy[10000]; int a[100];int x[1000000];int n, k;int max(){ int m = x[0]; for(int i=1; i<n
2016-04-04 22:31:08 1100
Rx_Net35_SP1
2019-03-13
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人