现在位置: 首页 > JeffryCarrier发表的所有文章
  • 11月
  • 11日
综合 ⁄ 共 874字 评论关闭
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST. Calling next() will return the next smallest number in the BST. Note: next() and hasNext() should run in average O(1) time and uses O(h) memory, where h is the height of the tree. 题目题意感觉不好理解,查了下大概是按中序遍历把节点非递归输出 /** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNod......
阅读全文
  • 06月
  • 09日
综合 ⁄ 共 12513字 评论关闭
c++insertdeletewindows测试null VC:CString用法大全 列表形式的如下: CString的构造函数CString( );例:CString csStr;CString( const CString& stringSrc );例:CString csStr("ABCDEF中文123456");CString csStr2(csStr);CString( TCHAR ch, int nRepeat = 1 );例:CString csStr('a',5);//csStr="aaaaa"CString( LPCTSTR lpch, int nLength );例:CString csStr("abcdef",3);//csStr="abc"CString( LPCWSTR lpsz );例:wchar_t s[]=L"abcdef";CString csStr(s);//csStr=L"abcdef"CString( const unsigned char* p......
阅读全文
  • 06月
  • 07日
综合 ⁄ 共 2057字 评论关闭
package my; import java.io.File; import java.io.IOException; import java.net.URL; public class MyUrlDemo { public static void main(String[] args) { MyUrlDemo muDemo = new MyUrlDemo(); try { muDemo.showURL(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void showURL() throws IOException { // 第一种:获取类加载的根路径 D:\git\daotie\daotie\target\classes File f = new File(this.getClass().getResource("/").get......
阅读全文
  • 04月
  • 24日
综合 ⁄ 共 1070字 评论关闭
#include<cstdio> #include<cstring> #define maxn 100001 #define mod 10007 inline int read() { int x = 0; char ch = getchar(); while (ch < '0' || ch > '9')ch = getchar(); while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } return x; } int n, m; int a[maxn]; int s[maxn]; int q[maxn]; int f[2][maxn]; int l, r, ans, ans2; inline bool mark(int k) { int sum, piece = m, now = 1; while (piece &a......
阅读全文
  • 04月
  • 02日
综合 ⁄ 共 547字 评论关闭
From: http://www.cnblogs.com/kex1n/archive/2011/11/16/2251520.html   在map中插入元素 改变map中的条目非常简单,因为map类已经对[]操作符进行了重载 enumMap[1] = "One"; enumMap[2] = "Two"; ..... 这样非常直观,但存在一个性能的问题。插入2时,先在enumMap中查找主键为2的项,没发现,然后将一个新的对象插入enumMap,键是2,值是一个空字符串,插入完成后,将字符串赋为"Two"; 该方法会将每个值都赋为缺省值,然后再赋为显示的值,如果元素是类对象,则开销比较大。我们可以用以下方法来避免开销: enumMap.insert(map&l......
阅读全文
  • 02月
  • 19日
综合 ⁄ 共 96字 评论关闭
今天在群里面看到大家发了这句可导一定连续,连续不一定可导。。大家应该都很熟悉,包括我自己,但是真正理解有多少呢,我当时就没想明白,中午吃饭的时候也在想,最后还是想明白了,特将数学推导放在这里:
阅读全文
  • 02月
  • 15日
综合 ⁄ 共 214字 评论关闭
sql string转换成int型 sql截取字符串 select cast(SUBSTRING('ddd25844', PATINDEX('%[0-9]%', 'ddd25844'), 4 )as int)   string转换成int型 cast('字符串型数字' as int)   sql 截取字符串 substring('要截取的字符串','开始截取的索引',截取的个数)   获取字符串特定位置的索引 patindex('匹配的表达式','被取的字符串')
阅读全文
  • 02月
  • 11日
综合 ⁄ 共 559字 评论关闭
n皇后问题不用多说,基本都知道。回溯算法也不用多说,还是比较简单的,给我的感觉就是不停的找一颗子树或一个排列,并加上判断以回溯。 /* * 经典回溯问题-----n皇后 */ #include<iostream> using namespace std; #define MAX 1024 int N; int column[MAX];//每行对应的列值 int sum=0; bool Place(int row,int col)//判断是否该行可以放置皇后 { int i=1; for(i;i<row;i++) { if((column[i]-col)==(i-row)||(column[i]-col)==(row-i)||column[i]==col) return false; } return tru......
阅读全文
  • 02月
  • 08日
综合 ⁄ 共 589字 评论关闭
      以Word 2003为例说明之。          首先,在VC中添加新的类,并选择FROM   A   type   Library  ,在Office的安装目录的OFFICE11目录下选择MSWORD.OLB   然后在导入的众多类中选择你需要的类或者全选。            然后在程序中使用          #include   "msword9.h"          #include   <AtlBase.h>          _Application   app;         app.CreateDispatch(_T("Word.Application"));         app.SetVisible(TRUE);                       Documents   docs=app.GetDocuments();                       _Document......
阅读全文
  • 01月
  • 22日
综合 ⁄ 共 1410字 评论关闭
外汇的发展历史 - 外汇交易市场的演变 黄金汇兑制及布雷顿森林协定 1967 年,一家芝加哥银行拒绝向一位名为 Milton Friedman 的大学教授提供英镑贷款,因为他意图利用这笔基金卖空英磅。Friedman 先生察觉到当时英磅对美元的比价过高,想先卖出英磅,然后等英磅下跌后再买回英磅来偿还银行,从而能够迅速大捞一笔。这家银行拒绝提供贷款的依据是 20 年前确立的《布雷顿森林协定》。此协定固定了各国货币对美元的汇率,并将美元与黄金的比价设为 35 美元对每盎司黄金。 布雷顿森林协定签订于 1944 年,力图通过阻止货币在国家间逃......
阅读全文
  • 01月
  • 21日
综合 ⁄ 共 755字 评论关闭
寻找最大数 时间限制:1000 ms  |  内存限制:65535 KB 难度:2 描述 请在整数 n 中删除m个数字, 使得余下的数字按原次序组成的新数最大, 比如当n=92081346718538,m=10时,则新的最大数是9888   输入 第一行输入一个正整数T,表示有T组测试数据 每组测试数据占一行,每行有两个数n,m(n可能是一个很大的整数,但其位数不超过100位,并且保证数据首位非0,m小于整数n的位数) 输出 每组测试数据的输出占一行,输出剩余的数字按原次序组成的最大新数 样例输入 2 92081346718538 10 1008908 5 样例输出 9888 98......
阅读全文
  • 12月
  • 15日
综合 ⁄ 共 2211字 评论关闭
1,第一种 /*** 图片裁剪(适用于大图裁剪)* @param activity* @param uri* @param fileUri 裁剪之后图片保存文件的uri*/public static void ImageCut(Activity activity, Uri uri,Uri fileUri){Intent intent = new Intent("com.android.camera.action.CROP");intent.setDataAndType(uri, "image/*");intent.putExtra("crop", "true");intent.putExtra("noFaceDetection", true);intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);activity.startActivityForResult(intent, REQUESTCODE_IMAGECUT);} 2,第二种 /*** 图片裁剪......
阅读全文