Activity for Lundinâ€
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Edit | Post #293005 | Initial revision | — | 11 days ago |
Answer | — |
A: Display a Progress Bar [C (gcc)], 88 bytes char a[53]={91},p=a+1,i;f(n,d){for(;i<50;)p[i++]=1.n/d<=i/50.?45:124;p[i]=93;puts(a);} Try it online! There's two approaches to this in C that I came up with - either write into an array then print it, or print everything at once but use conditionals. I tried ... (more) |
— | 11 days ago |
Comment | Post #292830 |
@#53890 It depends on the language. Many languages block execution if there are serious compiler diagnostics ("errors"). Other languages like C and C++ do not. The important part here is that the program must run. But as usual each solution would compete against other solutions with a similar approac... (more) |
— | about 1 month ago |
Comment | Post #292756 |
It doesn't really matter that much, it's just an offset of fixed number of characters that you add/remove to the total. But it's quite far-fetched (at least in the C family of languages) to say that input and output to a program may come through function parameters IMO, which I believe are the defaul... (more) |
— | about 1 month ago |
Edit | Post #292831 | Initial revision | — | about 2 months ago |
Question | — |
Category migration and the sandbox This has probably been discussed before but I couldn't find any posts about it. I think we should re-make the sandbox category in the following way: - Votes in the sandbox category should not count towards user reputation. If users get intimidated to post sandbox proposals fearing down-votes,... (more) |
— | about 2 months ago |
Edit | Post #292830 | Initial revision | — | about 2 months ago |
Question | — |
Source with the whole alphabet in order of appearance The challenge is to write as short a source as possible, where the English alphabet (in alphabetical order from top to bottom) `"abcdefghijklmnopqrstuvwxyz"` is a sub-sequence of the source code. The first mentioning of the next expected letter is the only one that counts. If a letter appears ear... (more) |
— | about 2 months ago |
Edit | Post #292376 |
Post edited: |
— | about 2 months ago |
Edit | Post #292756 |
Post edited: |
— | about 2 months ago |
Edit | Post #292756 | Initial revision | — | about 2 months ago |
Answer | — |
A: How many odd digits? [C (gcc)], 41 bytes r;o(chars){for(;s;r+=s++&1);return r;} Try it online! This is under the assumption that in a function solution, input has to be passed as parameter and output through the return value. The result variable is allocated outside the function to get gcc implicit i... (more) |
— | about 2 months ago |
Edit | Post #292376 |
Post edited: Added a rule about comments |
— | about 2 months ago |
Comment | Post #292376 |
@#8056 I could have sworn that I had written a rule about comments but apparently not. Thanks, will fix! (more) |
— | about 2 months ago |
Comment | Post #292376 |
@#53890 I honestly have no idea but probably all of the mainstream ones. Perhaps less so esoteric languages? The challenge accepts answers which is "language x + library y" even if "y" isn't officially part of the language/standard but some common extension. Like for example one could post an answer ... (more) |
— | 3 months ago |
Edit | Post #292376 |
Post edited: |
— | 3 months ago |
Comment | Post #292376 |
@#53890 That sounds much clearer indeed, I'll use that - thanks! (more) |
— | 3 months ago |
Edit | Post #292376 |
Post edited: |
— | 3 months ago |
Edit | Post #292376 |
Post edited: |
— | 3 months ago |
Edit | Post #292376 |
Post edited: |
— | 3 months ago |
Comment | Post #292376 |
These are good points, I think I should just edit that part out since it is vague. Come to think of it, that part was probably meant to been under the rule forbidding user constants like 0xABCDEF because that would make things too easy. (more) |
— | 3 months ago |
Edit | Post #292376 |
Post edited: |
— | 3 months ago |
Edit | Post #292376 | Initial revision | — | 3 months ago |
Article | — |
Source with the whole alphabet in order of appearance [FINALIZED] The challenge is to write as short a source as possible, where the English alphabet (in alphabetical order from top to bottom) `"abcdefghijklmnopqrstuvwxyz"` is a subsequence of the source code. The first mentioning of the next expected letter is the only one that counts. If a letter appears earli... (more) |
— | 3 months ago |
Edit | Post #288397 |
Post edited: |
— | 4 months ago |
Comment | Post #291759 |
I think so too. Either the 0 counts or it doesn't. (more) |
— | 5 months ago |
Comment | Post #287067 |
This could be shaved down to 30 bytes if you are going to use GNU C extensions anyway (I just posted another answer). In case the aim was to use conforming C then it won't fly, because then you have to use `int main` and you are not allowed to declare `printf` in any other form than `int printf(const... (more) |
— | 6 months ago |
Edit | Post #291648 | Initial revision | — | 6 months ago |
Answer | — |
A: "Hello, World!" [C (gcc)], 30 bytes main(){puts("Hello, World!");} Try it online! This is using GNU C extensions. GNU C allows `main()` over `int main()`, ss well as using `puts` without including stdio.h. (more) |
— | 6 months ago |
Comment | Post #290437 |
In case of for example the first `1`, there are zero identical numbers preceding it. So how does it become `1` and not `0`? Shouldn't the text rather say "the number of identical integers preceding it, including itself" or something like that. (more) |
— | 12 months ago |
Comment | Post #289996 |
Also check out [Integer to Roman numeral](https://codegolf.codidact.com/posts/279820). (more) |
— | about 1 year ago |
Edit | Post #289517 | Initial revision | — | over 1 year ago |
Answer | — |
A: Reverse the bits in a Byte [C (gcc)], 42 bytes c;f(i){c++>1));} Try it online! Binary output version. (more) |
— | over 1 year ago |
Edit | Post #289516 |
Post edited: |
— | over 1 year ago |
Edit | Post #289516 |
Post edited: |
— | over 1 year ago |
Comment | Post #289436 |
Would it be allowed to make the output format in binary? (more) |
— | over 1 year ago |
Edit | Post #289516 | Initial revision | — | over 1 year ago |
Answer | — |
A: Reverse the bits in a Byte [C (gcc)], 47 bytes r,c;f(i){return c++>1)),r;} Try it online! I didn't manage to come up with anything better than the most obvious recursive implementation posted above. I tried to use a different algorithm based on iterating two counters instead, but it got quite a bit longer.... (more) |
— | over 1 year ago |
Comment | Post #285821 |
@#64628 I think the first sentence of the challenge already explains this pretty well. (more) |
— | over 1 year ago |
Edit | Post #286590 |
Post edited: |
— | over 1 year ago |
Comment | Post #285821 |
@#64628 This is defined by the official programming language specification. Like in the example given, by the ISO standard. Some languages might not have one (most esoteric programming languages don't) and then this challenge might not be suitable for that language. (more) |
— | over 1 year ago |
Comment | Post #285821 |
The program is free to do any form of input/output. (more) |
— | over 1 year ago |
Comment | Post #287540 |
Using the return value always seemed like cheating to me, unless the challenge says otherwise. I think our default rules allow it though(?). (more) |
— | over 1 year ago |
Comment | Post #286362 |
f(1,4) returns 5 so your solution is not correct... Similarly this algorithm is wrong in many other answers you have posted here too. To use your own math example, the correct algorithm would have to be `result = x*y; if(result==x+y) return 5; else return x*y;`. (more) |
— | over 1 year ago |
Comment | Post #279657 |
Well as it says in the (several years old) answer, I had no idea which system I got it running on when I did the edit. Might have been gcc/mingw/Windows. Anyway, probably best to refer to the function-only version. (more) |
— | over 1 year ago |
Comment | Post #279657 |
I think it might depend on which standard lib that is used (libc/glibc and so on). The revised 53 byte version should be pure standard C however. (more) |
— | over 1 year ago |
Edit | Post #288397 | Initial revision | — | over 1 year ago |
Answer | — |
A: Hosting fastest code challenges If restricting everyone to the same system, then we can force every contestant to use https://tio.run and the on-site bench-marking found below "debug" -> "real time" as efficiency metric. Example. Advantages: - No matter how (in)accurate, this gives everyone the same conditions and the same b... (more) |
— | over 1 year ago |
Edit | Post #287816 |
Post edited: |
— | almost 2 years ago |
Edit | Post #287816 |
Post edited: |
— | almost 2 years ago |