mattnewport
  • Member for 8 years, 4 months
  • Last seen more than a month ago
Alphanumeric Hello World
75 votes

C int main(void) { if (putchar(72)) if (putchar(101)) if (putchar(putchar(108))) if (putchar(111)) if (putchar(44)) if (putchar(32)) if (...

View answer
Letters in phone numbers
16 votes

C, 83 78 77 65 63 62 main(c){for(;~(c=getchar());putchar(c>96?20-c/122+5*c/16:c));} http://ideone.com/qMsIFQ

View answer
Olympic Games Logo - Free Style Edition
10 votes

C++ 1024 bytes Updated: Now with antialiasing. Code has been somewhat de-golfed while still fitting in (exactly) 1K. Doesn't use any library functions except ostream functions to write output file. ...

View answer
Self containing logs
9 votes

C++ 121 71 67 -10% = 60.3 #include<iostream> #define log(x)std::cout<<"log("#x") "<<(x)<<"\n" Used like this: int main() { int i = 777; ...

View answer
Build a snowman!
8 votes

This is a bit of a cheat as it is mostly reusing some existing code, but it's a slightly modified version of a C++ AMP realtime GPU path tracer I wrote. Most of the interesting code is here but ...

View answer
1, 2, Fizz, 4, Buzz
6 votes

C++, 130 126 119 115 #include<iostream> int i;int main(){for(auto&o=std::cout;++i<101;o<<'\n')i%3?o:o<<"Fizz",i%5?i%3?o<<i:o:o<<"Buzz";} Live ...

View answer
It's super effective!
5 votes

C++14, 420 416 #include<iostream> #include<string> std::string m,t,n="NorFigFlyPoiGroRocBugGhoSteFirWatGraElePsyIceDraDarFai";int i;int main(){std::cin>>m>>t;auto k=[](auto y){...

View answer
Determine if Strings are equal
5 votes

C++, 63 58 56 const char* a = "string"; const char* b = "string"; int main(){while(*a**b*!(*a^*b))++a,++b;return!(*a^*b);}

View answer
Cardinals and ordinals, 1 to 100
3 votes

C++ 704 642 620 602 No library usage other than ostream operator<<() for char*s. #include<iostream> char*q,a[]="|one|two|three|four|five|six|seven|eight|ni&u$Il%*twel&bthirte$...

View answer
1, 2, Fizz, 4, Buzz
2 votes

C#, 97 bytes for(int x=0;x++<100;)System.Console.WriteLine(x%3*x%5>0?x+"":"FizzBuzz"[x%5>0?..4:x%3>0?4..:..]); Requires C# 9 for top level statements and range syntax.

View answer
1, 2, Fizz, 4, Buzz
2 votes

F#, 129 116 113 111 Seq.iter(fun x->printfn"%s"(["Fizz";"";""].[x%3]+(if x%5=0 then"Buzz"elif x%3>0 then string x else""))){1..100}

View answer
Print the character names
2 votes

C++14 716 706 704 #include<iostream> char*q,x,b[584],*t=b,a[]=R"(space}exclamation|mark}quot"-number|sign}dolla!apercent!mam"%sand}apostrophe}left|par%3hesis}righ"Wasterisk}...

View answer
Print every character your program doesn't have
2 votes

C++ 143 #include<fstream> #include<iostream> char c[256],d,e=32;int main(){for(std::fstream i(__FILE__);i>>d;)c[d]++;for(;++e<127;)c[e]||std::cout<<e;} Alternative version ...

View answer
The answer to life, the universe, and everything
2 votes

C++ Calculates the partitions of 10 via a rather inefficient method. Took 130s to run in a Release build on my system but someone with a sufficiently fast PC should be able to run it in ~75s... #...

View answer
Count the words in a text and display them
2 votes

F# - 169 let f s=(s+"").Split(set s-set(['a'..'z']@['A'..'Z']@['0'..'9'])|>Set.toArray)|>Seq.where((<>)"")|>Seq.countBy id|>Seq.sortBy((~-)<<snd)|>Seq.iter((<||)(printfn"...

View answer
1, 2, Fizz, 4, Buzz
1 votes

Hoon, 115 bytes This is a Hoon say generator which can be used to write the output to a file from the dojo. turn is Hoon's map, it takes a list from 1..100 generated via (gulf 1 100) and uses string ...

View answer
Print all 2 letter Scrabble Words
0 votes

F#, 205 bytes Seq.iteri(fun i s->Seq.iter(printf"%c%c "((char)i+'A'))s;printfn"")("ABDEGHILMNRSTWXY AEIOY EO DFHLMNRSTX AE O AEIMO DFNST O AI AIO AEIMOUY AEOU ...

View answer
Output Pi without math
0 votes

C++, 214 202 Only works for little-endian processors... Big-endian version would be shorter. #include<algorithm> #include<iostream> #include<iterator> union u{int i;char c[];};struct ...

View answer
Rotate An Integer Array with an O(n) algorithm
0 votes

C++, 136 template<int N>void rotate(int(&a)[N],int k){auto r=[](int*b,int*e){for(int t;--e>b;t=*b,*b++=*e,*e=t);};r(a,a+k);r(a+k,a+N);r(a,a+N);}

View answer
Print custom alphabet
0 votes

C, 117 main(c,s,d){d=c=getchar(),s=getchar();for(s=s<0?32:s^46?0:10;d+=d+6&31?1:-25,s&&isalpha(c)&&d^c;printf("%c%c",d,s));} Credit to schnaader for the d+6&31 trick. ...

View answer
Execute prints backwards
0 votes

C++ #include <iostream> #define print(s) std::cout << s << "\n"; return g; } #define f []{ auto g = int main() { f f f f []{}; print ("Line 1"); print ("Line 2"); ...

View answer
ASCII art "Hello-World!"
0 votes

F# - 204 characters for s in(Seq.map(Seq.unfold(function|0L->None|i->Some(" #".[int(i%2L)],i/2L)))[173948798213L;174770890021L;191304848727L;182715110773L;45277009173L;191279670629L])do printfn"...

View answer
Print every character your program doesn't have
0 votes

Javascript 94 a="",r="for(v=32;v<128;)c=String.fromCharCode(v++),a+=r.indexOf(c)<0?c:\"\"; alert(a)";eval(r)

View answer
Print every character your program doesn't have
0 votes

F# - 66 Set.iter(printf"%c")(set[' '..'~']-set"Set.ir(pnf\"%c)s[' ~]-\\")

View answer