在js中常见的六种数据类型:String类型、Null类型、Number类型、Boolean类型、Object类型。1、typeof的注意点涉及到数据类型,不免会提到,操作符 typeof。要注意:1、typeof是操作符,不是方法。虽然我们经常使用typeof()的方式获取对象的数据类型。2、对 ...
分类:
编程语言 时间:
2014-09-09 15:49:48
阅读次数:
276
--判断表是否存在,如果存在则删除declare num number; begin select count(1) into num from all_tables where TABLE_NAME = 'EMP' and OWNER='SCOTT'; if...
分类:
数据库 时间:
2014-09-09 15:45:38
阅读次数:
254
题目链接:zoj 3816 Generalized Palindromic Number
题目大意:给定n,找一个最大的数x,保证x小于n,并且x为palindromic number
解题思路:枚举前i个放于n相同的数,然后去构造后半部分即可。
#include
#include
#include
using namespace std;
typedef unsigned...
分类:
其他好文 时间:
2014-09-09 13:20:28
阅读次数:
131
题目链接:Codeforces 464C Substitutes in Number
题目大意:给定一个字符串,以及n中变换操作,将一个数字变成一个字符串,可能为空串,然后最后将字符串当成一
个数,取模1e9+7。
解题思路:将操作倒过来处理,这样维护每个数来的val,len两个,val表示对应数值取模1e9+7,len表示对应有多少
位,再计算的过程中要使用。
#inc...
分类:
其他好文 时间:
2014-09-09 13:13:48
阅读次数:
197
Letter Combinations of a Phone Number
Total Accepted: 15964 Total
Submissions: 60700My Submissions
Given a digit string, return all possible letter combinations that the number could repr...
分类:
其他好文 时间:
2014-09-09 13:13:39
阅读次数:
191
本题使用动态规划法思想。
因为需要一步一步地替换相对应的数字的,如果直接模拟,那么就需要大量插入和删除操作,最快也需要lg(n)的效率,但是最后数列就会变得非常长,这样最后计算结果遍历一次也会超时的。故此使用数据结构加速替换操作,并不是好办法。
这就使用动态规划法从后往前替换,相当于路径压缩了,一步直接把数字替换成最终结果的数字。
也要记录好每个数字最终替换成多少个数位,以便正确计算结果。
可以画树来模拟一下替换操作,那么从叶子节点往根节点替换数字,把所有的路径都直接压缩起来。...
分类:
其他好文 时间:
2014-09-09 13:11:48
阅读次数:
259
题目原文:
Determine whether an integer is a palindrome. Do this without extra space.
click to show spoilers.
Some hints:
Could negative integers be palindromes? (ie, -1)
If you are thinking of conv...
分类:
其他好文 时间:
2014-09-09 13:04:18
阅读次数:
156
[leetcode]Letter Combinations of a Phone Number...
分类:
其他好文 时间:
2014-09-09 12:49:58
阅读次数:
224
题意:给你一个数,计算他的阶乘有多少位。
算阶乘再看位数必超时。1
想每次%10 。一开始用int 果然有精度问题。于是double水了。600+ms
后来想到可以 log 10 () 。于是900+ms。
总觉得不对。应该有公式。看discuss 后终于知道了。
#include
#include
#include
#include
#inclu...
分类:
其他好文 时间:
2014-09-09 12:37:18
阅读次数:
165