HDU 1085 gives the number limit of the parent function problem Holding Bin-laden captive!

Source: Internet
Author: User

Holding Bin-laden captive!

Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 17256 Accepted Submission (s): 7734


Problem descriptionwe all know this bin-laden is a notorious terrorist, and he have disappeared for a long time. But recently, it's reported that he hides in hang Zhou of china!
"Oh, god! How terrible! ”



Don ' t is so afraid, guys. Although he hides in a cave of the Hang Zhou, the He dares not the go out. Laden is so bored recent years that he fling himself to some math problems, and he said that if anyone can solve his pro Blem, he'll give himself up!
ha-ha! Obviously, Laden is too proud of he intelligence! But, what's his problem?
"Given some Chinese Coins (coins) (three kinds--1, 2, 5), and their number is num_1, num_2 and num_5 respectively, please OU Tput the minimum value that's cannot pay with given coins. "
You, super Acmer, should solve the problem easily, and don ' t forget to take $25000000 from bush!

Inputinput contains multiple test cases. Each test case contains 3 positive integers num_1, num_2 and Num_5 (0<=num_i<=1000). A test case containing 0 0 0 terminates the-input and this-test case are not-to-be processed.

Outputoutput the minimum positive value that one cannot pay with given coins, one line for one case.

Sample INPUT1 1 30 0 0

Sample Output4

Authorlcy

Recommendwe carefully selected several similar problems for you:1171 2152 2082 1709 2079
#include <stdio.h>#include<string.h>intc[10000],temp[10000];intcost[3]={1,2,5};intnum[3];intMain () { while(SCANF ("%d%d%d", &num[0],&num[1],&num[2])!=EOF) {      if(num[0]==0&&num[1]==0&&num[2]==0)         Break; inttotal=num[0]*1+num[1]*2+num[2]*5; Memset (c,0,sizeof(c)); memset (temp,0,sizeof(temp));  for(intI=0; i<=num[0];i++) C[i]=1;  for(intI=1;i<3; i++){             for(intj=0; j<=total;j++){                 for(intk=0; k+j<=total&&k/cost[i]<=num[i];k+=Cost[i]///This step should pay special attention to ensure that the total value of k/cost[i]〈num[i] K should not exceed the range given in the question Temp[k+j]+=C[j]; }             for(intIi=0; ii<=total;ii++) {C[ii]=Temp[ii]; TEMP[II]=0; }        }     for(intI=1; i<=total+1; i++)    if(!C[i]) {printf ("%d\n", i);  Break; }   }   return 0;}

HDU 1085 gives the number limit of the parent function problem Holding Bin-laden captive!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.