Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with Search options user 59292

Code-golf is a competition to solve a particular problem in the fewest bytes of source code. If you want to score by characters instead of bytes, please state this explicitly in the challenge. If source code length is not the primary scoring criterion, consider using another tag instead.

13
votes
7answers
Introduction You are a supervisor of a parking lot and your manager is preparing for shrinking the size to the extreme. It is a simplified and adapted version of a problem in last year's PAT top-lev …
asked Jan 7 '17 by Keyu Gan
1
vote
C (gcc) + Win32, 94 95 98 105 107 110 bytes #import"d3d.h" j;f(){for(;;)for(j=191;j--;)GetAsyncKeyState(j)&(j<16||j>18)?printf("%d",j):0;} The code captures keys even after focus is lost. The foll …
answered Jul 17 '17 by Keyu Gan
1
vote
Mathematica, 95 102 105 112 bytes If[#4==#2,Echo@#,If[#4>#2,#0[#<>"S",#2+2,0,#4];#0[#<>"V",#2+Min[3#3+3,9],#3+1,#4]]]&["",0,0,#]& There should be a lot of golfing potential. Bascially it is a recu …
answered Jul 5 '17 by Keyu Gan
1
vote
Mathematica, 250 256 259 384 bytes ~0.00035 seconds for the java code case. (i=o=p="";a=Array;r=StringLength;If[Length@#>0,g=#&@@#;h=#[[2]];u=r@g;v=r@h;i=i<>g;o=o<>h;w=Abs[v-u];k=a[" "&,w];If[u<v, …
answered Oct 5 '17 by Keyu Gan
0
votes
Wolfram Language (Mathematica), 79 bytes SparseArray[100+{#2+#,#2-#}&@@#&/@Range@100~Tuples~2->Flatten@#,{301,301}," "]& Try it online! The input should be padded as exactly 100x100. The output is …
answered Apr 5 by Keyu Gan
2
votes
To achieve an ascending key-value list, use Sort instead of SortBy For lists such as list = {{1, "world"}, {0, "universe"}, {2, "country"}}, the following three statements are almost equivalent. Sor …
answered Jul 5 '17 by Keyu Gan
9
votes
Mathematica, 37 44 48 60 62 bytes Take input as a list of integers {1, 1, 1, 2, 2}. Try it on Wolfram Sandbox. Pattern-matching method, thanks @Not a tree ! Count[Split/@Permutations@#,{{_}..}]& …
answered Jul 11 '17 by Keyu Gan
1
vote
Wolfram Language (Mathematica), 101 126 bytes Alphabet[][[#&@@#&@@Position[(t=ToCharacterCode)@"nZ-Be_;f%d^q 0w@x~KDaLJ&`k",Total@t@#~Mod~98+32]]]& +32 seems leading to the shortest stirng hashtabl …
answered Oct 11 '17 by Keyu Gan
0
votes
Mathematica, 141 142 bytes g[x_:0,___]:=x;f=#<>""&/@(Thread@h[x=#~PadRight~99&/@(Characters[#<>"$"]&/@#),Max/@Outer[g@@Join@@Position[#-#2,y_/;y!=0]&,x,x,1]]/.h->Take)& I think I can golf it a bit. …
answered Jul 11 '17 by Keyu Gan
1
vote
Mathematica, 30 bytes And@@PrimeQ@ToCharacterCode@#& Quite self-explanatory.
answered Jul 17 '17 by Keyu Gan
4
votes
Wolfram Language (Mathematica), 23 24 26 29 bytes Length@Split@#~Max~1-1& Try it online! -1 byte thanks to Martin Ender! -2 bytes thanks to JungHwan Min! nice use of Split[]. -3 bytes thanks to t …
answered Oct 26 '17 by Keyu Gan
4
votes
C (gcc), 169 171 173 160 164 bytes #define F(A,B,C)for(i=A;B--;)printf(C); #define P puts("");F(y,i," ")F(abs(n)-y s,i,x,y;f(n){x=n<0;for(s=x?1-n:n;s--;){y=x?-n-s:s;P,i,x?"\\/":"/\\")y+=x;P,s>x&&i, …
answered Jul 10 '17 by Keyu Gan
3
votes
Wolfram Language (Mathematica), 100 bytes (and 134 for a working trumpet) l="Bb,B,C,C#,D,Eb,E,F,F#,G,G#,A"~StringSplit~",";f=l[[Mod[#&@@#&@@l~Position~#-2#2-#3-3#4-1,12]+1]]& Try it online! Quite …
answered Mar 16 '18 by Keyu Gan
1
vote
C (gcc), 115 117 120 bytes g(char*a){a=*a-65+!!a[1]*(7-*a/70-*a/67);}f(x,y)char*x,*y;{x="(pP$HL<lt<X"[g(x)]*32+"=ZukW-^h1F 6"[g(x)]>>g(y)&1;} Try it online! Return 1/0 for consonat and dissonat …
answered Sep 19 '17 by Keyu Gan
1
vote
C, 142 bytes #define _(x,y) while(y)printf("%.*s\n",d,x-c); f(char*a,char*b){int c=1,d=strlen(a)+1;while(*++a==*++b)c++;_(a,--d>=c)d++;_(b,d++<strlen(b-c))} Provide f(char* str1, char* str2).
answered Sep 4 '16 by Keyu Gan

15 30 50 per page