ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1047. Simple Calculations

Approximation method
Posted by VladG 23 Oct 2002 14:26
I think that this problem could be solved also by an approximation
method. (In adition to discovering the exact expression for a[1])

The method that I offer in simplifaction look as follows:

for (i=1; i<=elemNum; i++)
  a[i] = 0;

for (j=0; j<elemNum*N; j++) {
  for (i=1; i<=elemNum; i++)
    a[i] = (a[i-1] + a[i+1]) / 2 - c[i];

  printf("%.2f", a[1]);

I think that after enough number of iterations it should reach the
exact answer.

Though, some tests that I ran with this method gave the right result,
but it gave a Wrong Answer when I submitted.
May be I need to make some tunnings to my method.

What do you think?
There's an exact formula (-)
Posted by Miguel Angel 24 Oct 2002 05:55
> I think that this problem could be solved also by an approximation
> method. (In adition to discovering the exact expression for a[1])
>
> The method that I offer in simplifaction look as follows:
>
> for (i=1; i<=elemNum; i++)
>   a[i] = 0;
>
> for (j=0; j<elemNum*N; j++) {
>   for (i=1; i<=elemNum; i++)
>     a[i] = (a[i-1] + a[i+1]) / 2 - c[i];
>
>   printf("%.2f", a[1]);
>
> I think that after enough number of iterations it should reach the
> exact answer.
>
> Though, some tests that I ran with this method gave the right
result,
> but it gave a Wrong Answer when I submitted.
> May be I need to make some tunnings to my method.
>
> What do you think?