Problem C: Celebrity Split
~Â ä~~~~öö
Problem C: Celebrity Split
Jack and Jill have decided to separate and divide their property equally. each of their N mansions has a value between 1,000,000 and 40,000,000 dollars. jack will receive some of the mansions; Jill will receive some of the mansions; the remaining mansions will be sold, and the proceeds split equally.
Neither Jack nor Jill can tolerate the other loading ing prZ loading · Capacity "http://www.bkjia.com/kf/ware/vc/" target = "_ blank" class = "keylink"> memory + Memory + authorization + authorization + CjxoMz4KPC9oMz4KCjxoMj4KvNnI58rkyOs8L2gyPgo8cHJlIGNsYXNzPQ = "brush: java, "> 560000003000000030000001100000030000000Ó ¦ μ ± Ê ä³ öö
41000000
#include
#include#include
#include
#include
#include
using namespace std;int sum[200],a[200],ans;void fun();void divide(int p,int diff,int hav)//p:Ê£Óà·¿×ÓÊý£¬differ:Á½È˲î¼Û£¬hav:Á½È˹²È¡×ßµÄÇ{int i,j,n;if(diff==0&&ans
sum[p])//¼ôÖ¦1return;if(sum[p]+hav>n&&n){for(i=0;i
>a[i];if(i==0)sum[i]=a[0];elsesum[i]=sum[i-1]+a[i];}ans=0;divide(n-1,0,0);cout<