Redian新闻
>
Monsanto declare Share buyback
avatar
Monsanto declare Share buyback# Stock
a*e
1
平时几乎不用c++,有没有哪位同学帮看看怎么能让这段程序通过编译?我觉得自己思
路是对了的,不知道如果面试中碰到这种情况是否影响?没觉得哪里template用错了啊
?多谢
主要是在
Point x(a,b);
std::map::iterator it=mp.find(x);
if (it==mp.end())
mp.insert(std::pair(x,1));
else
mp[x]++;
/**
* Definition for a point.
* struct Point {
* int x;
* int y;
* Point() : x(0), y(0) {}
* Point(int a, int b) : x(a), y(b) {}
* };
*/
class Solution {
public:
int maxPoints(vector &points) {
int n=points.size();
if (n==0) return 0;
int a=0,b=0;
map mp;

for (int i=0; i{
for (int j=i+1;j{
a=(points[j].y-points[i].y)/(points[j].x-points[j].x);
b=points[j].y-(points[i].y-points[j].y)*points[j].x/(points[
i].x-points[j].x);
Point x(a,b);
std::map::iterator it=mp.find(x);
if (it==mp.end())
mp.insert(std::pair(x,1));
else
mp[x]++;
}
}
int res=-1;
for(auto it = mp.begin(); it != mp.end(); it++)
{
if (it->second>res)
{
res=it->second;
}
}

return res;
}
};
avatar
h*z
2
今天收到email,说我上个月挣了$5 reward,但我没有看见$40 ink recycle reward.
avatar
l*u
5
I see mine ink reward today

【在 h**z 的大作中提到】
: 今天收到email,说我上个月挣了$5 reward,但我没有看见$40 ink recycle reward.
avatar
r*e
7
哥们,你这个算法有问题啊。
1 为啥用map不用unordered_map? map 是棵树啊,后一个才是hashMap。不过这个其实
无所谓。
2. a=(points[j].y-points[i].y)/(points[j].x-points[j].x);
结果不是整数啊,会被强制取整的啊,这样不好。
下一行也是。
3. x 是个Point啊,我记得map活着unordered——map 对[]的重载只有在x是
primitive type才行。
avatar
g*g
8
really? When did you recycle last month?
Mine has issue too, does not show up in transaction history as previously
Also no payout on this Thursday

【在 l********u 的大作中提到】
: I see mine ink reward today
avatar
o*y
9
算是利空,股价还应该继续往下么

【在 l*******r 的大作中提到】
: PE还是太高。。
: 得买5B才行。。

avatar
r*e
10
楼上的楼上(2楼)说的对。

【在 r*******e 的大作中提到】
: 哥们,你这个算法有问题啊。
: 1 为啥用map不用unordered_map? map 是棵树啊,后一个才是hashMap。不过这个其实
: 无所谓。
: 2. a=(points[j].y-points[i].y)/(points[j].x-points[j].x);
: 结果不是整数啊,会被强制取整的啊,这样不好。
: 下一行也是。
: 3. x 是个Point啊,我记得map活着unordered——map 对[]的重载只有在x是
: primitive type才行。

avatar
E*o
11
我的也出问题了,没有看见ink reward.

【在 h**z 的大作中提到】
: 今天收到email,说我上个月挣了$5 reward,但我没有看见$40 ink recycle reward.
avatar
m*0
12
why?
buyback一般是利好消息啊。

【在 o**y 的大作中提到】
: 算是利空,股价还应该继续往下么
avatar
a*e
13
多谢。
改了改,还是通不过,看来得VS里面debug去了
/**
* Definition for a point.
* struct Point {
* int x;
* int y;
* Point() : x(0), y(0) {}
* Point(int a, int b) : x(a), y(b) {}
* };
*/
class Solution {
public:
int maxPoints(vector &points) {
int n=points.size();
if (n==0) return 0;
double a=0,b=0;
map, int> mp;
int x1,x2,y1,y2;

for (int i=0; i{
for (int j=i+1;j{
y1=points[j].y, y2=points[i].y,x1=points[j].x, x2=points[i].
x;
if (x1==x2)
{
a=0;
b=x1;
}
else
{
a=double(y1-y2)/double(x1-x2);
b=double(y2)-double(y1-y2)*x2/(x1-x2);
}
std::map,int>::iterator it=mp.find(pair<
double,double>(a,b));
if (it==mp.end())
mp.insert(std::pair,int>(pairdouble>(a,b),2));
else
mp[pair(a,b)]++;
}
}
int res=1;
for(auto it = mp.begin(); it != mp.end(); it++)
{
if (it->second>res)
{
res=it->second;
}
}

return res;
}
};
avatar
G*8
14
我的一个帐号也有问题。2/22投的手上有发票,但是transaction里没有显示。
可能要手动输入 missing receipt?
LD的帐号2/26投的已经看到rewards。

【在 g******g 的大作中提到】
: really? When did you recycle last month?
: Mine has issue too, does not show up in transaction history as previously
: Also no payout on this Thursday

avatar
l*r
15
stock buyback貌似对股价没什么帮助,印象中,过去一年ATVI/RIMM/GOOG都买锅的,
结果还是熊样 ...

【在 o**y 的大作中提到】
: 算是利空,股价还应该继续往下么
avatar
g*g
17
看来他们的系统出问题了
今天问客服
居然忽悠我说每月第三个周四才会payout
让我再等一星期
ft

【在 G*8 的大作中提到】
: 我的一个帐号也有问题。2/22投的手上有发票,但是transaction里没有显示。
: 可能要手动输入 missing receipt?
: LD的帐号2/26投的已经看到rewards。

avatar
o*y
18
老巴好像说过,有公司会利用buyback来造成自己EPS还不错的假相,其实经营并没那么好

【在 m********0 的大作中提到】
: why?
: buyback一般是利好消息啊。

avatar
a*e
19
看了你的解法,但是直接存斜率不行吗?是担心精度问题是吧?但是int/int 精度可能
没啥影响吧?
avatar
G*8
20
我把发票刚才手动输进去了,看看会咋样。
反正有发票所以不太担心。

【在 g******g 的大作中提到】
: 看来他们的系统出问题了
: 今天问客服
: 居然忽悠我说每月第三个周四才会payout
: 让我再等一星期
: ft

avatar
r*e
22
你比较double值肯定不会用==吧?这里也是一样的,找key的时候可能不准。
当然我见过别人用直接存储斜率的办法,也能过。

【在 a***e 的大作中提到】
: 看了你的解法,但是直接存斜率不行吗?是担心精度问题是吧?但是int/int 精度可能
: 没啥影响吧?

avatar
D*3
23
Food.Inc 中的主角之一?
avatar
a*e
24
我再看了看 http://www.cplusplus.com/reference/unordered_map/unordered_map/unordered_map/
请问你怎么知道那个map不用先判断是否里面有key对应的val,直接就像你那么写?int
curr=++map[key];(我是说你那么写是对的,但我不知道哪里能找到可以那么用的说
明?)
key=0L;key+=x;key<<=32;key+=y;
//find x,then y;
int curr=++map[key];
localmax=max(curr,localmax);
不用先判断key是否存在,像下面myMap这样
int hor = points[j].x - points[i].x;
int ver = points[j].y - points[i].y;
float k = 0==hor? numeric_limits::infinity() : 1.0*
ver/hor;
if (myMap.find(k)!=myMap.end())
{
myMap[k]++;
}
else
{
myMap[k] = 1;
}
avatar
a*e
25
can someone brief why this stock (MON) drop a lot in past few month?
avatar
o*y
26
co-ask

【在 a******e 的大作中提到】
: can someone brief why this stock (MON) drop a lot in past few month?
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。