公司股权问题
我刚刚在网上偶然发现了这个问题。事情大概是这样的。
有些公司持有其他公司的股份。我想知道一家公司是否拥有另一家公司。
所以,问题是这样的,如果公司1拥有公司2超过75%的股份,他就自动拥有它。另一个问题是,如果公司 1 拥有公司 3 75% 以上的股份,而公司 3 又拥有公司 2 75% 以上的股份,那么公司 1 就拥有公司 2。
这是一个更清晰的例子:
Company 1 owns 50% of Company 2
Company 1 owns 75% of Company 3
Company 3 owns 25% of Company 2
Therefore, Company 1 owns Company 2
我认为这将涉及递归,将所有权过程拆分为公司。但是,我不知道如何实现这一点。非常感谢您的帮助!
*更新:抱歉没有正确定义问题。该问题由记录组成,包含三条数据,如上所示,问题是找出某个公司是否拥有另一家公司(例如,公司 1 是否拥有公司 2?)。
因此,我计划将每个所有权值存储给所有者(对于直接所有权),并减少间接所有者的所有权值(如果拥有> 75%,则替换为下一个所有者),直到达到基数。感谢您的建议!
I've just stumbled upon this problem on the net. It kind of goes something like this.
There are corporations that have stakes in other corporations. And I would like to find out if one company owns another company.
So, the problem is this, if company 1 owns more than 75% of company 2, he automatically owns it. And another twist is that if company 1 owns more than 75% of company 3 that owns more than 75% of company 2, then company 1 owns company 2.
Here's a clearer example:
Company 1 owns 50% of Company 2
Company 1 owns 75% of Company 3
Company 3 owns 25% of Company 2
Therefore, Company 1 owns Company 2
I think it will involve recursion, splitting the ownership process by company. However, I can't figure out how to implement this. Thank you very much for your help!
*Update : Sorry for not properly defining the problem. The problem consists of records, containing three pieces of data, as seen above, and the problem is to find out if a certain company owns another (eg does company 1 own company 2?).
So I'm planning to store each ownership value to the owner (for direct ownership) and reduce the ownership value of indirect owners (if own > 75%, then replace w/ next owner) until it reaches the base. Thanks for the suggestions!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我对这份名单、它的长度以及涉及多少家公司没有做任何假设。我也不假设所有公司都是相互关联的。该列表有可能形成许多不同的所有权图。我还假设允许某种形式的共同所有权的场景是可能的(A 拥有 B 的 75%,B 拥有 A 的 75%,我承认这种情况很奇怪,但从数学上讲,没有什么可以阻止这种情况发生
)解决绝对所有权可以这样完成:
第一遍 - 确定一家公司与其他公司的所有关联。
现在我们有了 C 可能拥有的公司列表 (A),原始列表中的所有其他公司都可以忽略。
现在让我们计算一下实际所有权。这里我们尝试计算 C 在所有其他公司中的实际股份。如果 C 拥有 X 的 50%,而 X 拥有 Y 的 50%,则 C 拥有 Y 的 25%。考虑到 75% 规则,如果一家公司在任何时候拥有另一家公司 70% 或更多的股份,我们会自动转换 75% % 变为 100%。
这将执行一种回溯算法,在建立所有权时重新评估权益。最后,您应该拥有数组 C[],其中包含 C 在所有其他公司中的所有净股份。如果其中任何一个超过 75%,则 C 拥有它。
这是一种非常残酷的算法,最好将两个通道合并为一个通道,以使其成为一个更优雅的解决方案,尽管在这一点上我更喜欢获得有效的证据,而不是看起来或性能良好的证据。我没有尝试过,只是在心里跑了一下,所以我可能是错的。不过,我认为这将涵盖共同所有权周期。但是,要查看共同所有权,您必须为列表中的每个公司重复替换 C 的过程。然后您就可以从每家公司直接看到完整的所有权情况。
--- 编辑 ---
我希望我没有误解这里,这个问题确实很难完全理解。如果我们有一大堆公司,并且所有权是在三元组中定义的,那么您可以通过让列表成为捆绑在一起的所有三元组来执行以下操作。这将创建一个更大的图,但解决一个图比解决一组相互依赖的图容易得多
I make no assumption on the list, how long it can be and how many companies are involved. I also make no assumption that all companies are linked. It is possible the list can form many distinct ownership graph. I also assume it is possible for scenarios allowing some form of mutual ownership (A own 75% of B and B own 75% of A, strange situation I'll admit but mathematically there is nothing preventing this from happening)
A Brute Force algorithm to solve absolute ownership could be done this way :
First pass - Determine all associations of a company with other companies.
Now we have a list (A) of companies that C can potentially own, all other companies in the original list can be ignored.
now let's calculate the actual ownership. Here we attempt to calculate the actual stakes C has in all other companies. If C owns 50% of X and X owns 50% of Y then C owns 25% of Y. To take into account the 75% rule, if at any point a company has 70% or more stakes in another we automatically convert the 75% into 100%.
This will perform a sort of backtracking algorithm that will re-evaluate stakes when ownership is established. At the end you should have the array C[] with all the net stakes C has in all other companies. If any are above 75% then C owns it.
This is a very brute algorithm, it would be preferable to merge the two passes into one to make it a more elegant solution though at this point I prefer getting proof of something that works rather than something that looks or performs good. I have not tried it, only ran it mentally so I could be very wrong. However I think it would cover the mutual ownership cycles. However to see the mutual ownership you would have to repeat the procedure replacing C for every company in the list. Then you would have a complete picture of ownership directly visible from each company.
--- EDIT ---
I hope I did not misunderstand here, the question is indeed hard to fully grasp. If we have a large set of companies and ownership is defined in triplets then you could do as below by letting the list be all the triplets bundled together. This would create a larger graph but solving one graph is much easier than solving a set of interdependent graphs
我认为以下方法有效,但我没有彻底测试它。坦白说,我不确定我是否理解您的要求。
根据输入构建有向图。每个命名的公司都成为一个顶点。每条边代表公司之间的所有权关系,其权重等于所有权百分比。
要确定哪些公司属于特定公司,请使用以下伪代码:
I think the following works, but I didn't thoroughly test it. Frankly I'm not sure I even understand your requirements.
Construct a directed graph based on the input. Each named company becomes a vertex. Each edge represents an ownership relationship between companies and has a weight equal to the ownership percentage.
To determine which companies are owned by a specific company, use the following pseudocode: