Search found 19 matches

by IIUC GOLD
Thu Apr 07, 2005 8:43 am
Forum: Volume 3 (300-399)
Topic: 369 - Combinations
Replies: 101
Views: 17186

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 value of c...
by IIUC GOLD
Thu Apr 07, 2005 8:35 am
Forum: Volume 3 (300-399)
Topic: 369 - Combinations
Replies: 101
Views: 17186

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 value of c...
by IIUC GOLD
Sun Feb 20, 2005 6:52 am
Forum: Volume 102 (10200-10299)
Topic: 10268 - 498-bis
Replies: 51
Views: 17362

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 . ...
by IIUC GOLD
Thu Sep 09, 2004 3:05 pm
Forum: C++
Topic: use of qsort for one dimentional array
Replies: 2
Views: 1678

by IIUC GOLD
Mon Aug 16, 2004 3:49 pm
Forum: Volume 106 (10600-10699)
Topic: 10689 - Yet another Number Sequence
Replies: 22
Views: 11537

Natalya:

You did a very silly mistake.

Just check your code's output for the following input:

Code: Select all

1
10 12 1 1
I think now you will be able to find your fault.

Also note that Pisano period is valid for all a and b.
by IIUC GOLD
Sat Aug 14, 2004 3:37 pm
Forum: Volume 106 (10600-10699)
Topic: 10689 - Yet another Number Sequence
Replies: 22
Views: 11537

If you know "Pisano period" then you can solve the problem very easily. The last digit of Fibonacco number repeats with a period of 60. The last two digits repeat with a period of 300, the last three with a period of 1500 and the last four digits have a period of 15000. See the following link: http:...
by IIUC GOLD
Sun Aug 08, 2004 1:53 pm
Forum: C
Topic: printf(), C string & Comma operator
Replies: 2
Views: 2386

printf(), C string & Comma operator

The following code
[c]char* strTest="Hello";
printf(("%s World!!", strTest));
[/c]
gives output

Code: Select all

Hello
Can anyone explain the output.
by IIUC GOLD
Mon Jul 12, 2004 3:34 pm
Forum: Volume 102 (10200-10299)
Topic: 10268 - 498-bis
Replies: 51
Views: 17362

Use Horner's Rule to solve the Problem.

No need to use BigInt. Long is enough to solve the problem.
by IIUC GOLD
Wed Jun 30, 2004 5:49 am
Forum: Volume 106 (10600-10699)
Topic: 10677 - Base Equality
Replies: 11
Views: 3412

Read the following input description " Notice that all numbers in the input are given in the base 10." So, 9240 is a 10 based number. Now, convert it in B1(11) based number and take the digits (6)(10)(4)(0). I have parenthesized a single digit. Now assume that it is a base B2(14) number and convert ...
by IIUC GOLD
Thu Apr 22, 2004 3:48 pm
Forum: Volume 102 (10200-10299)
Topic: 10252 - Common Permutation
Replies: 150
Views: 51293

This problem can be solved very easily with the frequency caluculation of each character. Suppose, the input strings are: bbaccbacd abbcdbaae For the first string the frequency distribution is: a 2 b 3 c 3 d 1 And for the second string the frequency distribution is: a 3 b 3 c 1 d 1 e 1 Calculate the...
by IIUC GOLD
Fri Jun 27, 2003 6:27 pm
Forum: Algorithms
Topic: Bisection Method
Replies: 30
Views: 7357

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: p...
by IIUC GOLD
Sat Jun 21, 2003 4:55 pm
Forum: Volume 3 (300-399)
Topic: 358 - Don't Have A Cow
Replies: 52
Views: 10695

Your Output is not correct. My AC program gives the following output:

R = 100, P = 0.33, Rope = 90.64
R = 100, P = 0.10, Rope = 47.16
R = 100, P = 0.50, Rope = 115.87
by IIUC GOLD
Wed Jun 18, 2003 1:29 pm
Forum: Algorithms
Topic: Bisection Method
Replies: 30
Views: 7357

You are correct Dominik Michniewski. NR is Newton-Raphson Method. Another very good problem of Numerical method is The roots (10428). At first I tried it with Bisection method. But got either TLE or WA. Then I got accepted by applying NR method with Synthetic Division. I am intersted to know the nam...
by IIUC GOLD
Tue Jun 17, 2003 2:11 pm
Forum: Algorithms
Topic: Bisection Method
Replies: 30
Views: 7357

Railway (10263) is a good problem which can be solved by Bisection method.
by IIUC GOLD
Sat May 31, 2003 5:22 pm
Forum: Volume 103 (10300-10399)
Topic: 10302 - Summation of Polynomials
Replies: 29
Views: 15135

Use the following

result = n * n * (n + 1) * (n + 1) /4;

instead of

result=(long long)pow(n*(n+1)/2,2);

Go to advanced search