s********3 发帖数: 231 | 1 刚刚玩,昨天看到PostRock Energy Corporation (PSTR),这只股,涨了很多,上了排
行榜了,但是成交量很低啊。
这种股可以买嘛?
谢谢 |
|
w****x 发帖数: 2483 | 2 int _inner_ways(const char* pStr)
{
if (*pStr == 0)
return 1;
if (*pStr <= '0' || *pStr > '9')
return 0;
int n = _inner_ways(pStr+1);
if ((*pStr == '1' && *(pStr + 1) >= '0' && *(pStr + 1) <= '9')
|| (*pStr == '2' && *(pStr + 1) >= '0' && *(pStr + 1) <= '6'))
n += _inner_ways(pStr+2);
return n;
}
int GetWays(const char* pStr)
{
if (NULL == pStr || *pStr == 0)
return 0;
return _inner_ways(pStr);
}
int GetWaysDP(const char* pStr)
... 阅读全帖 |
|
d****n 发帖数: 233 | 3 Here is a iterative one. I know there is another iterative one which is more
compact.
bool isMatch(const char *str, const char *pattern) {
const char *pstr = str, *pp = pattern;
bool findStar = false;
while (*pstr && *pp) {
if (*pp == '*') {
str = pstr;
pattern = pp + 1;
findStar = true;
}
if (*pstr == *pp || *pp == '?') {
pstr++;
pp++;
con... 阅读全帖 |
|
p********7 发帖数: 549 | 4 node* rebuild(int *pstr, int *istr, int n)
{
if (n <= 0)
return NULL;
node* root = new node;
root->data = *pstr;
int* iter;
for (iter = istr; iter < pstr + n; iter++)
if (*iter == *pstr)
break;
int k = iter - istr;
root->left = rebuild(pstr+1, istr, k);
root->right = rebuild(pstr + k + 1, istr + 1+ k, n - k - 1);
return root;
} |
|
l****c 发帖数: 838 | 5 You should read in the string and parse.
You don't know how long the first part string is or how long the number is.
So if you define:
char tempprice[10];
char ticker[10];
You have the risk of buffer overflow.
Here is my solution. I debug it as I wrote it, so it is not optimized.
it is pure C. You can get result with 2 lines of perl or python code
============================
#include
#include
#include
int main()
{
char *str = "GOOD|89.34";
char *ptoken, *... 阅读全帖 |
|
j**l 发帖数: 2911 | 6 我就写个很简洁的从前序和中序序列重建二叉树的代码吧,以飨版友。
TreeNode* rebuild(char *pstr, char *istr, int n)
{
if (n <= 0)
return NULL;
TreeNode* root = new TreeNode;
root->data = *pstr;
char* iter;
for (iter = istr; iter < istr + n; iter++)
if (*iter == *pstr)
break;
int k = iter - istr;
root->left = rebuild(pstr + 1, istr, k);
root->right = rebuild(pstr + k + 1, iter + 1, n - k - 1);
return root;
} |
|
j**l 发帖数: 2911 | 7 写个简洁的从前序和中序序列重建二叉树的代码,以飨版友。
TreeNode* rebuild(char *pstr, char *istr, int n)
{
if (n <= 0)
return NULL;
TreeNode* root = new TreeNode;
root->data = *pstr;
char* iter;
for (iter = istr; iter < istr + n; iter++)
{
if (*iter == *pstr)
break;
}
int k = iter - istr;
root->left = rebuild(pstr + 1, istr, k);
root->right = rebuild(pstr + k + 1, iter + 1, n - k - 1);
return root;
} |
|
j**l 发帖数: 2911 | 8 再次贴一下简洁的从前序和中序序列重建二叉树的代码
TreeNode* rebuild(char *pstr, char *istr, int n)
{
if (n <= 0)
return NULL;
TreeNode* root = new TreeNode;
root->data = *pstr;
char* iter;
for (iter = istr; iter < istr + n; iter++)
if (*iter == *pstr)
break;
int k = iter - istr;
root->left = rebuild(pstr + 1, istr, k);
root->right = rebuild(pstr + k + 1, iter + 1, n - k - 1);
return root;
} |
|
G***n 发帖数: 877 | 9 Hi,
I have a question using C. I want to
allocate the memory using realloc() or
malloc() inside a function fun(), the
return of this function is the pointer
pointing to the allocated memory. There
is no free() inside fun(), because I
need to grasp the allocated memory in
fun() by its return.
In the main function, I define char
*pStr= fun() to call this function and
then try to free pStr later using
free(pStr). The program runs forever at
free(pStr) there. However, if I do not
use free() function... 阅读全帖 |
|
p**o 发帖数: 3409 | 10 手写了一些C扩展,有些返回多重指针的函数不知道怎么用SWIG来包来供Python调用……
比如下面这个strsplit()函数,返回的是char**,怎么改才能让Python收到一个list (
of strings)?
http://www.swig.org/tutorial.html
我只是照tutorial简单地把函数声明抄进.i文件,Python中调用时返回的是
#include
#include
#include
/* Split an input string 'instr', using a set of given delimiters, to an
array of strings of at most 'maxparts' parts. */
char **strsplit (const char *instr, const char *delimiters, size_t maxparts)
{
char *... 阅读全帖 |
|
j**l 发帖数: 2911 | 11 for (iter = istr; iter < istr + n; iter++)被你改成
for (iter = istr; iter < pstr + n; iter++)
这个改动不对
root->right = rebuild(pstr + k + 1, iter + 1, n - k - 1)被你改成
root->right = rebuild(pstr + k + 1, istr + 1 + k, n - k - 1)
不过这两个等价,因为k等于iter - istr |
|
e******d 发帖数: 310 | 12 I want to sort strings using qsort(), and try the following code, but doesn
't work. Could you please help me out. Thank you.
=============================================
#include "stdlib.h"
#include "stdio.h"
#include "string.h"
int mystrcmp(const void * str1, const void * str2)
{
return strcmp( (const char*)str1, (const char*)str2 ) ;
}
int main()
{
int n = 4;
char *pstr[] = {"God", "Bed", "Act", "Cup"};
qsort(pstr, n, sizeof(char*), mystrcmp);
int i = 0;
for(i = 0; |
|
t******e 发帖数: 1293 | 13 赞简洁
不过,如果给的*pstr和*istr实际上不是一颗树的前序和中序,
貌似你的code会出问题,在那个for循环那里应该报错。 |
|
p********7 发帖数: 549 | 14 root->right = rebuild(pstr + k + 1, istr + 1+ k, n - k - 1);
我刚才弄错了,应该就是这个地方
节点的字符不重复。 |
|
w****r 发帖数: 245 | 15 大侠,分类都分好了,求神签
# Basic Materials, Agricultural Chemicals
AGU Agrium Inc.
AVD American Vanguard Corp.
CAGC China Agritech Inc.
CF CF Industries Holdings, Inc.
CGA China Green Agriculture, Inc.
CMP Compass Minerals International
COIN Converted Organics Inc.
IPI Intrepid Potash, Inc.
MON Monsanto Co.
MOS Mosaic Co.
NOEC New Oriental Energy & Chemical
POT Potas... 阅读全帖 |
|
|
a**s 发帖数: 405 | 17 之前有倒闭了几家,不过大多数都是private company。目前美国一共142家油气开采上
市公司,其中负债率达到50%以上的有42家:
NasdaqCM:ZAZA
NYSE:PQ
NYSE:GDP
NYSE:UPL
NasdaqGM:PSTR
NYSE:XCO
NYSE:MPO
NasdaqCM:ISRL
NYSE:WTI
NasdaqGS:FXEN
NasdaqGS:EXXI
NYSE:SFY
NYSE:SN
NYSE:MILL
AMEX:SPP
NYSE:HK
NasdaqGS:LGCY
NasdaqGS:LINE
NasdaqGS:WRES
AMEX:TPLM
NYSE:MHR
NYSE:REN
NYSE:PVA
NasdaqGS:MEMP
NasdaqGS:ROSE
NYSE:ATLS
NYSE:LRE
NYSE:SD
NYSE:ARP
NYSE:CRK
NasdaqGS:MRD
NYSE:CRC
NYSE:CWEI
AMEX:NOG
AMEX:PED
NasdaqGS:VNR
NasdaqGS:REXX
NasdaqGM:LLEX
NYSE:SGY
AMEX:GST
N... 阅读全帖 |
|
M***n 发帖数: 5815 | 18 agcs (Chen)在帖子里曾经贴过
http://www.mitbbs.com/article/Stock/36269827_0.html
agcs 的帖子的具体内容是:
之前有倒闭了几家,不过大多数都是private company。目前美国一共142家油气开采上
市公司,其中负债率达到50%以上的有42家:
NasdaqCM:ZAZA
NYSE:PQ
NYSE:GDP
NYSE:UPL
NasdaqGM:PSTR
NYSE:XCO
NYSE:MPO
NasdaqCM:ISRL
NYSE:WTI
NasdaqGS:FXEN
NasdaqGS:EXXI
NYSE:SFY
NYSE:SN
NYSE:MILL
AMEX:SPP
NYSE:HK
NasdaqGS:LGCY
NasdaqGS:LINE
NasdaqGS:WRES
AMEX:TPLM
NYSE:MHR
NYSE:REN
NYSE:PVA
NasdaqGS:MEMP
NasdaqGS:ROSE
NYSE:ATLS
NYSE:LRE
NYSE:SD
NYSE:ARP
NYSE:CRK
NasdaqGS:MRD
NYSE:CRC
... 阅读全帖 |
|
n******i 发帖数: 598 | 19 SECTOR LAYOFFS
Oilfield Services 58,624
Acme 99
Advanced Stimulation Technologies 69
Alberta Innovates – Technology Futures 28
Archer Ltd. 1,000
Baker Hughes 6,991
Cajun Cutters 2
Caterpillar CAT -1.9% 200
Civeo 1,000
Dresser-Rand 648
Ensign Energy Services 700
FMC Technologies FTI -2.3% 2,079
General Electric GE -0.55% 500
Halliburton 6,620
Helmerich & Payne HP -0.12% 2,13... 阅读全帖 |
|
P********e 发帖数: 2610 | 20 int AppendString(
LPWSTR pStr,
UINT & charIndex
... )
in the header there is "..." in the parameter
what does this "..." mean? |
|
n*******r 发帖数: 425 | 21 Mon
Earnings: Penson Worldwide (PNSN), Vina Concha y Toro (VCO), SYKES
Enterprises (SYKE), Western Gas Partners (WES), Pearson (PSO), Great Plains
Energy (GXP), Berkshire Hathaway (BRK.A), CVR Energy (CVI), HSBC Holdings (
HBC), Southwestern Energy (SWN), Berkshire Hathaway (BRK.B), Lowe's (LOW)
Economic Data: Pending Home Sales
Tues
Earnings: NXT Energy Solutions (NSFDF), Noble Group (NOBGF), Ceragon
Networks (CRNT), Grupo Aeroportuario del Pacifico SAB (PAC), Federal Mogul (
FDML), ViewP... 阅读全帖 |
|
n*******r 发帖数: 425 | 22 Mon Earnings: RRSat Global Communications Network (RRST), Envoy Capital
Group (ECGI), Webzen (WZENY), Insignia Systems (ISIG), Asset Acceptance
Capital (AACC), Uranium One (SXRZF), CompuCredit (CCRT), Stereotaxis (STXS),
ZST Digital Networks (ZSTN), Vina Concha y Toro (VCO), Indosat Tbk PT (IIT)
, Acura Pharmaceuticals (ACUR), Pinnacle Airlines (PNCL), Kohlberg Capital (
KCAP), Antigenics (AGEN), Trinity Biotech (TRIB), Steinway Musical
Instruments (LVB), Searchlight Minerals (SRCH), Cross C... 阅读全帖 |
|
y*****l 发帖数: 5997 | 23 大家可以到涨幅榜看看每天的热门股:
http://finviz.com/screener.ashx?v=111&s=ta_topgainers&o=-change
板块表现:
http://finviz.com/groups.ashx
2/24 前20名
17个美股,3个中概。
板块:6个技术,4个原材料,4个金融,3个工业品。
http://finviz.com/screener.ashx?v=111&t=,CRFN,ROYL,EFUT,BW,TORM
2/25 前20名
17个美股,3个中概。
板块:6个技术,4个服务业,3个原材料,3个金融,3个消费品。
http://finviz.com/screener.ashx?v=111&t=ALAN,IOT,OVTI,ANLY,ATAI
3/1 石油金银
http://finviz.com/screener.ashx?v=111&t=SONS,RPRX,VTUS,BRD,BSET
3/2 今天石油还是热门板块,生拉,技术。
http://finviz.com/screener.ashx?v=111&t=LEI,EDGW,SYNM,ZBB... 阅读全帖 |
|
y*****l 发帖数: 5997 | 24 老蛇的大盘回顾
Cobra's Market View
http://cobrasmarketview.blogspot.com/
大家可以到涨幅榜看看每天的热门股:
http://finviz.com/screener.ashx?v=111&s=ta_topgainers&o=-change
板块表现:
http://finviz.com/groups.ashx
2/24 前20名
17个美股,3个中概。
板块:6个技术,4个原材料,4个金融,3个工业品。
http://finviz.com/screener.ashx?v=111&t=,CRFN,ROYL,EFUT,BW,TORM
2/25 前20名
17个美股,3个中概。
板块:6个技术,4个服务业,3个原材料,3个金融,3个消费品。
http://finviz.com/screener.ashx?v=111&t=ALAN,IOT,OVTI,ANLY,ATAI
3/1 石油金银
http://finviz.com/screener.ashx?v=111&t=SONS,RPRX,VTUS,BRD,BSET
3/2 今天石油还是热门板... 阅读全帖 |
|
|