My AC solution is as follows:
c = 1;
for (i=N,j=1;j<=R;i--,j++)
c=(c*i)/j;
Here, R is the minimum of M or N-M.
And the type of c is double or long long. All other variables are int.
It can also be solved by using c as an int. In that case, first divide c and j by gcd(c,j). Suppose the new ...
Search found 19 matches
- Thu Apr 07, 2005 8:43 am
- Forum: Volume 3 (300-399)
- Topic: 369 - Combinations
- Replies: 101
- Views: 33275
- Thu Apr 07, 2005 8:35 am
- Forum: Volume 3 (300-399)
- Topic: 369 - Combinations
- Replies: 101
- Views: 33275
- Sun Feb 20, 2005 6:52 am
- Forum: Volume 102 (10200-10299)
- Topic: 10268 - 498-bis
- Replies: 51
- Views: 24084
I didn't find any wrong with this problem.
You have to careful about the intermediate calcualtions. Although the problem description says that the output will fit in 32 bit integer, but the intermediate values may be larger than that. So, use Horner's rule to evaluate the derivative of polynomial ...
You have to careful about the intermediate calcualtions. Although the problem description says that the output will fit in 32 bit integer, but the intermediate values may be larger than that. So, use Horner's rule to evaluate the derivative of polynomial ...
- Thu Sep 09, 2004 3:05 pm
- Forum: C++
- Topic: use of qsort for one dimentional array
- Replies: 2
- Views: 2228
- Mon Aug 16, 2004 3:49 pm
- Forum: Volume 106 (10600-10699)
- Topic: 10689 - Yet another Number Sequence
- Replies: 22
- Views: 16127
Natalya:
You did a very silly mistake.
Just check your code's output for the following input:
I think now you will be able to find your fault.
Also note that Pisano period is valid for all a and b.
You did a very silly mistake.
Just check your code's output for the following input:
Code: Select all
1
10 12 1 1
Also note that Pisano period is valid for all a and b.
- Sat Aug 14, 2004 3:37 pm
- Forum: Volume 106 (10600-10699)
- Topic: 10689 - Yet another Number Sequence
- Replies: 22
- Views: 16127
- Sun Aug 08, 2004 1:53 pm
- Forum: C
- Topic: printf(), C string & Comma operator
- Replies: 2
- Views: 2957
printf(), C string & Comma operator
The following code
[c]char* strTest="Hello";
printf(("%s World!!", strTest));
[/c]
gives output
Can anyone explain the output.
[c]char* strTest="Hello";
printf(("%s World!!", strTest));
[/c]
gives output
Code: Select all
Hello
- Mon Jul 12, 2004 3:34 pm
- Forum: Volume 102 (10200-10299)
- Topic: 10268 - 498-bis
- Replies: 51
- Views: 24084
- Wed Jun 30, 2004 5:49 am
- Forum: Volume 106 (10600-10699)
- Topic: 10677 - Base Equality
- Replies: 11
- Views: 4666
- Thu Apr 22, 2004 3:48 pm
- Forum: Volume 102 (10200-10299)
- Topic: 10252 - Common Permutation
- Replies: 150
- Views: 73282
- Fri Jun 27, 2003 6:27 pm
- Forum: Algorithms
- Topic: Bisection Method
- Replies: 30
- Views: 10239
A polynomial function of degree n can be expressed as p (x) = (x - xr) q (x) where xr is the root of the polynomial p(x) and q(x) is the quotient polynomial of degree (n-1). By synthetic division we can obtain q(x) without performing the actual division. Synthetic division is performed as follows ...
- Sat Jun 21, 2003 4:55 pm
- Forum: Volume 3 (300-399)
- Topic: 358 - Don't Have A Cow
- Replies: 52
- Views: 16382
- Wed Jun 18, 2003 1:29 pm
- Forum: Algorithms
- Topic: Bisection Method
- Replies: 30
- Views: 10239
- Tue Jun 17, 2003 2:11 pm
- Forum: Algorithms
- Topic: Bisection Method
- Replies: 30
- Views: 10239
- Sat May 31, 2003 5:22 pm
- Forum: Volume 103 (10300-10399)
- Topic: 10302 - Summation of Polynomials
- Replies: 29
- Views: 18933