2013
12-29

# A1 = ?

1
50.00
25.00
10.00
2
50.00
25.00
10.00
20.00

27.50
15.00

2011-12-20 04:48:49
# include <stdio.h>
# include <string.h>

typedef struct NODE{
double a0, a1 ;
double c ;
}NODE ;

NODE node[3010] ;
double c[3010] ;
int n ;

double calc(double a, double b)
{
int i ;
memset(node, 0, sizeof(node)) ;
node[0].a0 = node[1].a1 = 1 ;
for (i = 2 ; i <= n+1 ; i++)
{
node[i].a0 = 2*node[i-1].a0 - node[i-2].a0 ;
node[i].a1 = 2*node[i-1].a1 - node[i-2].a1 ;
node[i].c = 2 * node[i-1].c - node[i-2].c + 2*c[i-1] ;
}
return (b - a*node[n+1].a0 - node[n+1].c)/node[n+1].a1 ;
}

int main ()
{
int i ;
double a, b ;
while (~scanf ("%d", &n))
{
scanf ("%lf%lf", &a, &b) ;
for (i = 1 ; i<= n ; i++)
scanf ("%lf", &c[i]) ;
printf ("%.2lf\n", calc(a,b)) ;
}
return 0 ;
}

1. #include <stdio.h>
int main()
{
int n,p,t[100]={1};
for(int i=1;i<100;i++)
t =i;
while(scanf("%d",&n)&&n!=0){
if(n==1)
printf("Printing order for 1 pages:nSheet 1, front: Blank, 1n");
else {
if(n%4) p=n/4+1;
else p=n/4;
int q=4*p;
printf("Printing order for %d pages:n",n);
for(int i=0;i<p;i++){
printf("Sheet %d, front: ",i+1);
if(q>n) {printf("Blank, %dn",t[2*i+1]);}
else {printf("%d, %dn",q,t[2*i+1]);}
q–;//打印表前
printf("Sheet %d, back : ",i+1);
if(q>n) {printf("%d, Blankn",t[2*i+2]);}
else {printf("%d, %dn",t[2*i+2],q);}
q–;//打印表后
}
}
}
return 0;
}