|
h**i 发帖数: 712 | 2 是啊,Linux下不太一样,直接在nbase下make没有目标,configure已经指定host和CC
,结果ld找不到库,nbase下的libnbase.a不知道为什么没识别。 |
|
w****x 发帖数: 2483 | 3 这题真TM坑爹啊~~
class node
{
int id;
int value;
int sum;
void send(int toId, int value);
int receive(int fromId);
void run()
{
int tmp = x;
int nLev = 0;
vector vec;
while (tmp%2 == 0)
{
int nRecv = x - (1 << nLev);
sum += receive(nRecv);
vec.push_back(nRecv);
nLev++;
}
if (id != n)
{
int nSend = min(id + (1 << nLev), n);
send(nSend, sum);
sum = receive(nSend);
}
else
... 阅读全帖 |
|
w****x 发帖数: 2483 | 4 这题真TM坑爹啊~~
class node
{
int id;
int value;
int sum;
void send(int toId, int value);
int receive(int fromId);
void run()
{
int tmp = x;
int nLev = 0;
vector vec;
while (tmp%2 == 0)
{
int nRecv = x - (1 << nLev);
sum += receive(nRecv);
vec.push_back(nRecv);
nLev++;
}
if (id != n)
{
int nSend = min(id + (1 << nLev), n);
send(nSend, sum);
sum = receive(nSend);
}
else
... 阅读全帖 |
|
w****x 发帖数: 2483 | 5 /*
Say you have an array for which the ith element is the price of a given
stock on day i.
Design an algorithm to find the maximum profit. You may complete as many
transactions as you like (ie, buy one and sell one share of the stock
multiple times). However, you may not engage in multiple transactions at the
same time (ie, you must sell the stock before you buy again).
*/
class Solution {
public:
int maxProfit(vector &a) {
int n = a.size();
int* rec = new int[n]... 阅读全帖 |
|
b*******h 发帖数: 53 | 6 这个dp算法有一个地方不懂:rec[j]是在第jth day卖出股票,这时的最大收益值。
这一块: int nBase = j-1 < 0 ? 0 : rec[j-1];
if (nBase + a[i] - a[j] > nMax)
nMax = nBase + a[i] - a[j];
为什么j-1th day卖出,一定要在jth day买入呢?有可能从j th day,股票一路下跌
,然后再长回来。
the |
|
h**i 发帖数: 712 | 7 交叉编译的时候报告 cannot find -lnbase |
|
|
|
i***r 发帖数: 1035 | 9 下面是一个简单的script 文件, 多谢:
@include "_bc_sort_stages.mro"
pipeline BC_SORT(
in bam input,
out bam bcsorted_bam,
)
{
call volatile BUCKET_BY_BC(
nbases = 2,
input = self.input,
)
call volatile BUCKET_BY_QNAME(
qnames = BUCKET_BY_BC.qnames,
input = BUCKET_BY_BC,
)
call volatile SORT_BY_BC(
bc_buckets = BUCKET_BY_BC.buckets,
non_bc_buckets = BUCKET_BY_QNAME.buckets,
)
return (
bcsorted_bam = SORT_BY_BC,
... 阅读全帖 |
|