Holding Bin-laden captive! (female function)

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): 17732 Accepted Submission (s): 7940


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 3 0 0 0

Sample OUTPUT4: Money array is the face value, the T array is the number of the current face value of the parent function is: (1+x+x^2+x^3+.....+x^a) * (1+x^2+x^4+....+x^2b) * (1+x^5+x^10+...+x ^5C); Code:
1#include <stdio.h>2#include <string.h>3 Const intmaxn=100010;4 intA[MAXN],B[MAXN];5 intMain () {6     intx,y,z,sum;7     intmoney[3],t[3];8      while(SCANF ("%d%d%d", &x,&y,&z), x| | Z|_z) {9Memset (A,0,sizeof(a)); memset (b,0,sizeof(b));//Initialize ... Ten          for(intI=0; i<=x;i++) a[i]=1, b[i]=0; Onet[0]=x;t[1]=y;t[2]=Z; Amoney[0]=1; money[1]=2; money[2]=5; -sum=money[0]*t[0]; -          for(intI=1;i<3; i++){ the          for(intj=0; j<=sum;j++) -              for(intk=0; k<=money[i]*t[i];k+=Money[i]) -b[j+k]+=A[j]; -sum+=money[i]*T[i]; +              for(intj=0; j<=sum;j++) -a[j]=B[j]; +         } A         //printf ("%d\n", sum); at          for(intI=0; i<=sum+1; i++) -             if(!A[i]) { -printf"%d\n", i); -                  Break; -             } -     } in     return 0; -}

Holding Bin-laden captive! (female function)

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.