UVA10375Chooseanddivide prime factor decomposition

Source: Internet
Author: User
Tags integer numbers
Prime factor decomposition: ChooseanddivideTimeLimit: & #160; 3000 MS & #160; MemoryLimit: & #160; Unknown & #160; 64 bitIOFormat: & #160; % lld & amp; % lluSubmit & #160; StatusDescriptionProblemD:


Prime factor decomposition:


Choose and divide
Time Limit:3000 MS   Memory Limit:Unknown   64bit IO Format:% Lld & % llu

Submit Status

Description

Problem D: Choose and divideThe binomial coefficientC (m, n)Is defined
         m!C(m,n) = --------         n!(m-n)!
Given four natural numbersP,Q,R, AndS, Compute the result of dividingC (p, q)ByC (r, s). The InputInput consists of a sequence of lines. Each line contains four non-negative integer numbers giving valuesP,Q,R, AndS, Respectively, separated by a single space. All the numbers will be smaller than 10,000P> = qAndR> = s. The OutputFor each line of input, print a single line containing a real number with 5 digits of precision in the fraction, giving the number as described above. you may assume the result is not greater than 100,000,000. sample Input
10 5 14 993 45 84 59145 95 143 92995 487 996 4882000 1000 1999 9999998 4999 9996 4998
Output for Sample Input
0.12587505606.460551.282230.489962.000003.99960

Source

Root: aoapc ii: Beginning Algorithm Contests (Second Edition) (Rujia Liu): Chapter 10. Maths: Examples
Root: aoapc I: Beginning Algorithm Contests (Rujia Liu): Volume 6. Mathematical Concepts and Methods
Root: Competitive Programming 2: This increases the lower bound of Programming Contests. Again (Steven & Felix Halim): Mathematics: Combinatorics: Binomial Coefficients
Root: Competitive Programming 3: The New Lower Bound of Programming Contests (Steven & Felix Halim): Mathematics: Combinatorics: Binomial Coefficients

Root: Competitive Programming: Increasing the Lower Bound of Programming Contests (Steven & Felix Halim): Chapter 5. Mathematics: Combinatorics
Root: Prominent Problemsetters: Gordon V. Cormack

Submit Status


#include 
 
  #include 
  
   #include 
   
    #include using namespace std;const int maxn=10010;int p,q,r,s;int prime[maxn],pn;long long int fnum[maxn],pnum[maxn];bool vis[maxn];void pre_init(){    memset(vis,true,sizeof(vis));    for(int i=2; i
    
     



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.