Day 7: Better crab
This commit is contained in:
parent
95b816e293
commit
370c901936
1 changed files with 12 additions and 11 deletions
|
@ -3,14 +3,15 @@
|
||||||
|
|
||||||
int main () {int
|
int main () {int
|
||||||
C [1000 ]={0 },
|
C [1000 ]={0 },
|
||||||
#define l for(c =\
|
*p=C,G=0 ,P=0,S=0
|
||||||
0,t= 0; c\
|
#define R(\
|
||||||
< n ; c ++ )
|
x) x=! P|| t<x ?t:x;
|
||||||
*p=C,G =0 ,P =0,S=0
|
,c,m=0 ,n =0 ,t;for
|
||||||
,c,m=0,n=0,t ;for(;fscanf
|
(;scanf("%i%*c" ,p)==1;p++,n
|
||||||
#define A abs(C[c]-P)
|
#define A abs(C[c]-P)
|
||||||
(stdin,"%i%*c",p)==1;p++,n++)if(*p>m
|
#define l( v, x) for(c =0 ,\
|
||||||
#define R( z) if (! P|| t< z)z=t;
|
t=0; c< n; c++ )t += v ;R(x)
|
||||||
)m=*p;for(;P<m;P++){l t+=A;R(S)l t+=A*(A+1)/
|
++)m=*p>m?*p:m;for(;P<m;P++){l(A,S)l((A*(A+1
|
||||||
2;R(G)}printf ("Silver: %"
|
))/2,G)} printf("Silv"
|
||||||
"u\nGold: " "%u\n",S,G);}
|
"er: %u\n" "Gold: %u\n"
|
||||||
|
,S ,G);}
|
||||||
|
|
Loading…
Reference in a new issue