#include using namespace std;int a[1000];int f(int n){ int k=0; while(n) { a[k++]=n%2; n/=2; } return k;}int main(int argc, char *argv[]){ int n,m,...
分类:
其他好文 时间:
2014-08-01 22:45:22
阅读次数:
248
属性将值和类,结构,枚举相关联。属性分为计算属性和存储属性。存储属性存储常量或变量作为实例的一部分 ,计算属性计算一个值。存储属性用于类和结构体,计算属性用于类,结构体和枚举。1:存储属性存储属性是存储类或结构体的实例里的一个常量或变量。struct Range{ var length:Int...
分类:
其他好文 时间:
2014-08-01 19:21:02
阅读次数:
148
斐波那契数列。。。利用斐波那契数列的循环:因为结果%n,所以最多有n^2个数后会出现循环。预处理,不能直接用f[maxn][maxn^2]来保存,数组太大。。。所以用vector来保存斐波那契数列%n 的值。 1 #include 2 #include 3 #include 4 #includ...
分类:
其他好文 时间:
2014-08-01 19:04:12
阅读次数:
173
Problem Description:
Given two numbers represented as strings, return multiplication of the numbers as a string.
Note: The numbers can be arbitrarily large and are non-negative.
分析:两个string相乘...
分类:
其他好文 时间:
2014-08-01 16:06:01
阅读次数:
141
注意n=1的情况#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;typed...
分类:
其他好文 时间:
2014-08-01 15:31:01
阅读次数:
260
题目:Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same re....
分类:
编程语言 时间:
2014-08-01 10:43:21
阅读次数:
266
题目:Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 w....
分类:
编程语言 时间:
2014-08-01 06:57:21
阅读次数:
297
Description:A message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded m...
分类:
其他好文 时间:
2014-08-01 04:39:01
阅读次数:
167
题目还原
Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number.
The function twoSum should return indices of the two numbers such that they add up t...
分类:
其他好文 时间:
2014-08-01 02:25:11
阅读次数:
391
Problem H
{sum+=i++} to Reach N
Input: standard input
Output: standard output
Memory Limit: 32 MB
All the positive numbers can be expressed as a sum of one, two or more consecutive positive i...
分类:
其他好文 时间:
2014-07-31 20:58:37
阅读次数:
199