2021-12-07 09:58:23 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
int main () {int
|
|
|
|
C [1000 ]={0 },
|
|
|
|
#define l for(c =\
|
|
|
|
0,t= 0; c\
|
|
|
|
< n ; c ++ )
|
|
|
|
*p=C,G =0 ,P =0,S=0
|
2021-12-07 11:32:55 +01:00
|
|
|
,c,m=0,n=0,t ;for(;fscanf
|
2021-12-07 09:58:23 +01:00
|
|
|
#define A abs(C[c]-P)
|
|
|
|
(stdin,"%i%*c",p)==1;p++,n++)if(*p>m
|
2021-12-07 11:32:55 +01:00
|
|
|
#define R( z) if (! P|| t< z)z=t;
|
|
|
|
)m=*p;for(;P<m;P++){l t+=A;R(S)l t+=A*(A+1)/
|
|
|
|
2;R(G)}printf ("Silver: %"
|
|
|
|
"u\nGold: " "%u\n",S,G);}
|