s*w 发帖数: 729 | 1 codeeval.com 上的一个题
给n个东西,每个东西有重量和价值,要求在重量小于给定值的时候,尽量价值大
在重量是浮点数的情况下,怎么做 bottomup 的 dp table?
我现在的解是 recursion, 而且没 memorization, 因为不知道怎么存这个 table.
帖下代码,请指教一下
#include
#include
#include
#include
#include
#include
using namespace std;
class Solution {
int weightLimit;
int n;
vector weights;
vector costs;
public:
Solution(const string &line) {
istringstream iss(line);
iss >> weightLimit;
int in... 阅读全帖 |
|
c*****n 发帖数: 96 | 2 Use factory pattern:
//Define a abstract class Cell which the application (Excel) will
//process.
public abstract class Cell {
....
public TValue getValue();
}
// Define concrete cell class
public class LiteralCell : Cell { // '500'
public override TValue getValue() { ... }
}
public class ExpressionCell :Cell { // 'A5 + A10'
public override TValue getValue() { ....}
}
public class FunctionCell : Cell { // 'f(A1, A2, A5)'
public override TValue getValue() { ....}
}
// define ... 阅读全帖 |
|
o******6 发帖数: 538 | 3 ☆─────────────────────────────────────☆
zhongyimin (Miumiu) 于 (Mon Mar 2 18:49:24 2009) 提到:
%macro glimmixtoexcel;
data xyzzy;
set parms_out;
keep est Effect isint;
if substr(Effect, 1, 9)='Intercept' then isint=1;
else isint=0;
stars=' ';
/* two tailed tests */
if 1.645<=abs(tValue)<1.960 then stars='+';
if 1.960<=abs(tValue)<2.576 then stars='*';
if 2.576<=abs(tValue)<3.291 then stars='**';
if abs(tValue)>=3.291 then stars='***';
estima |
|
c*******e 发帖数: 70 | 4 第一次试水北美找工作,前前后后持续4个月,拿到Amazon Fulltime offer,Google
Intern Host Match offer, 感谢那些一起刷题的朋友,感谢 watercold 帮主的帮助,
dgs的帮忙! 刷题群:229623621
资料: introduction to algorithm; cracking code;
Amazon:
Amazon 首先进行online assessment,经典7道题碰上了三题;
1: single linked list circle detection (命中)
2: sum up array of numbers in window size (命中)
3: matrix path,只能往左或往右,要求使得path上的number的最小值最大
4: linked list的倒数第K个节点
5: Give student result structure:
struct Result{
int studentID;
string data;
int ... 阅读全帖 |
|
z****8 发帖数: 7 | 5 quick sort ?
5:一群人排队,每个人有(height, Tvalue), height表示身高,Tvalue表示 前面有
几个比当前人身高高的人。。。然后顺序打乱,重新排队,复原以前的队列; |
|
f********x 发帖数: 2086 | 6
助,
求问这道题
5:一群人排队,每个人有(height, Tvalue), height表示身高,Tvalue表示 前面有几
个比当前人身高高的人。。。然后顺序打乱,重新排队,复原以前的队列;
没有思路
我能想到的是nlgn排序然后再n^2挨个插入
这样貌似很不理想的样子 |
|
l*****a 发帖数: 14598 | 7 sort by height
for the 1st shortest ,base on TValue, put it in the right place
then for the 2nd shortest,based on Tvalue and position of the first one,put
it in the right place
... |
|
A********r 发帖数: 2640 | 8 是我贴的,ms现在已经木有了,浣熊的已经被我收了
他们家类似的现在还有两款
http://www.urbanoutfitters.com/urban/catalog/category.jsp?
pushId=WOMENS&itemCount=80&selectedProductSize=&id=WOMENS_ACCESSORIES&star
tValue=1&selectedProductColor=&navCount=&prevVisit=true&navAction=jump&sor
tby=&prepushId=&popId= |
|
d******e 发帖数: 194 | 9 a more clear version as following:
template
class MyClass
{
public:
class Inner
{
public:
Inner(int v = 0): value(v) {};
private:
int value;
};
Inner CreateInner(int v = 0) const;
private:
T TValue;
};
template
MyClass::Inner MyClass::CreateInner(int v) const // error
{
return Inner(v);
}
It seems the problem is in return type, because it has no problem if I
implement it as inline:
Inner CreateInner(int v = 0) const |
|
p***7 发帖数: 535 | 10 I have a dataset test blow
Obs Variable Method Variances tValue DF Probt
1 age Pooled Equal 1.19 16 0.2522
2 age Satterthwaite Unequal 1.19 14.672 0.2538
Now I want to delete the second observation.
data testpval;
set test;
if df=14.672 then delete;
run;
Why is it not working?
Thanks |
|