觉得很精辟,所以转发,来自http://communities.intel.com/thread/20874 This is a fairly big problem with the Intel(R) HD Graphics chipset, and I could also use advice please Mr. Admin. Here's what you pull up when you do a directX printout of your system if you 're like me (I have a Toshiba Satellite): --------------- Display Devices --------------- Card name: Intel(R) HD Graphics Family Manufacturer: Intel Corporation Chip type: Intel(R) HD Graphics Family DAC type: Internal Device Key: Enum\PCI\VEN_8086&DEV_0106&SUBSYS_FCE01179&REV_09 Display Memory: 1696 MB Dedicated Memory: 64 MB Shared Memory: 1632 MB Herein lies our problem, and I don't think Toshiba and Intell really realize this problem - SO HEADS UP AND PAY ATTENTION Many of the new games out there scan specifically for "Dedicated memory." If the game does not detect a specific amount of dedicated memory, then it won't even start up (Battlefield 3 does this, and a few others too). I personally think that what Intell has done with shared memory is brilliant. It eliminates the need for a big bulky graphics card whose power is only used during demanding games, and allows resources that would normally only be used for video to be used for other programs when necissary. This creates a more versatile and efficient system; which, is especially desirable in labtops where space is a premium. However. Intell forgot that by doing this they would be making graphic cards (and thusly graphic card manufacturers) obsolete, or perhaps this was their intention all along. In any case, you can't expect the graphics card manufacturers to lie down and go out of business so easily. So, what did they do? They leveraged their partnerships with the gaming industry and made it to where the games would check in advance for dedicated memory before they ran. Thus, it doesn't matter how powerful a machine you buy with an Intel HD Graphics chipset, you still won't be able to play your game because of the politics of the gaming industry. Now, leveraging this asshattery even further, NVidia and other graphics card manufacturers have decided to start making their own line of labtops. So, not only do you have to buy the game, but you have to buy a specialized " gaming labtop" made by one of the graphics card manufacturers. No doubt EA and other gaming companies make a bit of a cut off of the profits made from the sale of these specialized, and very inefficient, labtops. So, in synopsis, the reason you can't play your game on your "plenty powerful enough to play your game" labtop is becuase of corporate warfare. God bless capitalism. The only way that this problem will be solved is if Intell installs a method in the bios or otherwise that enables gamers to dictate the specific amount of dedicated memory that they want allocated to video RAM. If Intell doesn 't catch on, they will suffer a big hit to their popularity and market share. What I want to know is: Is this problem known, and if so - is there a way for me to play Battlefield 3 and other advanced games with an Intell HD video chipseet? I know my machine has well and above enough processing power and memory to play these games, but the game is still refusing to play .
你写的这个好像是别人的方法,不记得了 你的问题,要求返回的是indexes or values or a simple true or false? 一般来说,是要找values或者是true or false 要是找index的话我觉得要额外做一些工作。。 我自己的方法是这样的 我们知道,用hashtable辅助,我们就可以找出两个数sum to a target in O(n). when we want to find 3 values, we can do following for each target-a[i], we try to see whether there are two numbers in the array(excluding the ith one) their sum is target-a[i]..
【在 P*******b 的大作中提到】 : thanks, : 是这样吗? : bool ThreeSum(vector nums) : { : std::sort(nums.begin(), nums.end()); : for (size_t i = 0; i < nums.size(); i++) : { : size_t j = 0; : size_t k = nums.size() - 1; : while ( j < k )