user avatar
user avatar
user avatar
badatgolf
  • Member for 6 months
  • Last seen this week
Stats
827
reputation
16k
reached
16
answers
3
questions
Loading…
About

Hi!

I mostly use C and C++ to golf. Pretty bad at it.

My avatar is the format code of my first try at golfing, here.

My first iter, 115 bytes:

int f(int*a,int n){int m=0,l=0,i=0;for(;i<n;++i){m+=(a[i]>=100+l)?100+l:a[i];l=(100-a[i]>=0)?100-a[i]:0;}return m;}

And my last iter, 78 bytes (that's 37 bytes save!)

m,l,g;f(a,n)int*a;{m=l=0;for(g=100;n--;++a)m+=fmin(g+l,*a),l=*a<g?g-*a:0;m=m;}

-25 bytes save by to AZTECCO and -4 bytes save by ceilingcat

This user doesn’t have any gold badges yet.
This user doesn’t have any silver badges yet.
13
bronze badges
43
Score
19
Posts
100
Posts %
22
Score
8
Posts
42
Posts %
19
Score
7
Posts
37
Posts %
15
Score
6
Posts
32
Posts %
10
Score
2
Posts
11
Posts %
4
Score
1
Posts
5
Posts %
Top posts
View all questions and answers
question
14
Jun 4
question
14
Jun 6
answer
5
Mar 3
answer
4
May 30
answer
4
Jun 8
answer
4
Mar 21
answer
4
Jan 19
answer
3
Jun 8
answer
3
Jun 9