user avatar
user avatar
user avatar
badatgolf
  • Member for 8 months
  • Last seen this week
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.
16
bronze badges
44
Score
20
Posts
100
Posts %
22
Score
9
Posts
45
Posts %
19
Score
7
Posts
35
Posts %
15
Score
6
Posts
30
Posts %
10
Score
2
Posts
10
Posts %
5
Score
1
Posts
5
Posts %
Top posts
View all questions and answers
question
18
2 days ago
question
14
Jun 4
question
14
Jun 6
answer
5
Mar 3
answer
5
May 30
answer
4
Jun 8
answer
4
Mar 21
answer
4
Jan 19
answer
3
Jun 8